@agoric/internal 0.4.0 → 0.4.1-upgrade-23-dev-bd79330.0.bd79330
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -4
- package/package.json +13 -11
- package/src/action-types.d.ts +47 -20
- package/src/action-types.d.ts.map +1 -1
- package/src/action-types.js +19 -19
- package/src/ava-force-exit.d.mts +2 -0
- package/src/ava-force-exit.d.mts.map +1 -0
- package/src/ava-force-exit.mjs +6 -0
- package/src/batched-deliver.d.ts +6 -2
- package/src/batched-deliver.d.ts.map +1 -1
- package/src/batched-deliver.js +7 -3
- package/src/build-cache-types.d.ts +33 -0
- package/src/build-cache-types.d.ts.map +1 -0
- package/src/build-cache-types.js +42 -0
- package/src/build-cache.d.ts +12 -0
- package/src/build-cache.d.ts.map +1 -0
- package/src/build-cache.js +184 -0
- package/src/callback.d.ts +9 -11
- package/src/callback.d.ts.map +1 -1
- package/src/callback.js +16 -10
- package/src/chain-storage-paths.d.ts.map +1 -1
- package/src/chain-storage-paths.js +0 -2
- package/src/chain-utils.d.ts +3 -1
- package/src/chain-utils.d.ts.map +1 -1
- package/src/chain-utils.js +6 -1
- package/src/config.d.ts +22 -3
- package/src/config.d.ts.map +1 -1
- package/src/config.js +25 -3
- package/src/debug.d.ts +4 -1
- package/src/debug.d.ts.map +1 -1
- package/src/debug.js +26 -15
- package/src/index.d.ts +2 -1
- package/src/index.js +10 -3
- package/src/js-utils.d.ts +7 -3
- package/src/js-utils.d.ts.map +1 -1
- package/src/js-utils.js +24 -3
- package/src/keyMirror.d.ts +3 -0
- package/src/keyMirror.d.ts.map +1 -0
- package/src/keyMirror.js +45 -0
- package/src/kv-store.d.ts +33 -0
- package/src/kv-store.d.ts.map +1 -0
- package/src/kv-store.js +257 -0
- 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/ava-unhandled-rejection.d.ts +18 -3
- package/src/lib-nodejs/ava-unhandled-rejection.d.ts.map +1 -1
- package/src/lib-nodejs/ava-unhandled-rejection.js +211 -20
- package/src/lib-nodejs/engine-gc.js +2 -2
- 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 +8 -7
- 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/lib-nodejs/worker-protocol.d.ts +1 -1
- package/src/lib-nodejs/worker-protocol.d.ts.map +1 -1
- package/src/lib-nodejs/worker-protocol.js +5 -5
- package/src/magic-cookie-test-only.d.ts.map +1 -1
- package/src/magic-cookie-test-only.js +0 -2
- 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 +11 -0
- package/src/marshal/cap-data.d.ts.map +1 -0
- package/src/marshal/cap-data.js +19 -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 +60 -0
- package/src/marshal/wrap-marshaller.d.ts.map +1 -0
- package/src/marshal/wrap-marshaller.js +432 -0
- package/src/module-utils.d.ts +1 -0
- package/src/module-utils.d.ts.map +1 -1
- package/src/module-utils.js +16 -0
- package/src/natural-sort.d.ts.map +1 -1
- package/src/natural-sort.js +48 -13
- package/src/netstring.d.ts +1 -1
- package/src/netstring.d.ts.map +1 -1
- package/src/netstring.js +5 -5
- 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/createBundles.d.ts.map +1 -1
- package/src/node/createBundles.js +3 -5
- 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 +58 -9
- package/src/node/read-json.d.ts +2 -0
- package/src/node/read-json.d.ts.map +1 -0
- package/src/node/read-json.js +18 -0
- package/src/node/shutdown.js +1 -1
- 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/queue.d.ts.map +1 -1
- package/src/queue.js +0 -2
- package/src/ses-utils.d.ts +27 -5
- package/src/ses-utils.d.ts.map +1 -1
- package/src/ses-utils.js +115 -20
- package/src/storage-test-utils.d.ts +15 -5
- package/src/storage-test-utils.d.ts.map +1 -1
- package/src/storage-test-utils.js +62 -8
- package/src/tagged.d.ts +18 -1
- package/src/testing-utils.d.ts +4 -0
- package/src/testing-utils.d.ts.map +1 -1
- package/src/testing-utils.js +88 -2
- package/src/typeGuards.d.ts +6 -2
- package/src/typeGuards.d.ts.map +1 -1
- package/src/typeGuards.js +7 -4
- package/src/types-index.d.ts +1 -0
- package/src/types.d.ts +34 -19
- package/src/types.d.ts.map +1 -1
- package/src/types.js +173 -0
- package/src/upgrade-api.d.ts.map +1 -1
- package/src/upgrade-api.js +4 -3
- 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/vendor/anylogger.d.ts +98 -0
- package/vendor/anylogger.d.ts.map +1 -0
- package/vendor/anylogger.js +60 -0
- package/vendor/anylogger.ts +160 -0
- package/vendor/tsconfig.anylogger.json +15 -0
- package/exported.js +0 -2
- package/src/marshal.d.ts +0 -33
- package/src/marshal.d.ts.map +0 -1
- package/src/types.ts +0 -129
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* eslint-disable -- vendored upstream source */
|
|
3
|
+
/**
|
|
4
|
+
* VENDORED SOURCE - DO NOT EDIT DIRECTLY
|
|
5
|
+
*
|
|
6
|
+
* Source of truth for the anylogger vendored module.
|
|
7
|
+
*
|
|
8
|
+
* This vendoring flow intentionally keeps three files:
|
|
9
|
+
* - `vendor/anylogger.ts`: upstream TypeScript source (kept close to upstream).
|
|
10
|
+
* - `vendor/anylogger.js`: generated runtime for consumers that import JS directly.
|
|
11
|
+
* - `vendor/anylogger.d.ts`: generated declarations for type imports from that same JS path.
|
|
12
|
+
*
|
|
13
|
+
* To regenerate generated artifacts after editing the TypeScript source file (vendor/anylogger.ts):
|
|
14
|
+
* `cd packages/internal && yarn run -T tsc --project vendor/tsconfig.anylogger.json`
|
|
15
|
+
*/
|
|
16
|
+
// prettier-ignore-start
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A log function is a function that takes a variable amount of
|
|
20
|
+
* arguments and returns void.
|
|
21
|
+
*/
|
|
22
|
+
export type LogFunction = (...args: any) => void;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The default base log levels for anylogger.
|
|
26
|
+
*/
|
|
27
|
+
export type LogLevels = {
|
|
28
|
+
error: 1;
|
|
29
|
+
warn: 2;
|
|
30
|
+
info: 3;
|
|
31
|
+
log: 4;
|
|
32
|
+
debug: 5;
|
|
33
|
+
trace: 6;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A log level is a string that is a key of `LogLevels`.
|
|
38
|
+
*/
|
|
39
|
+
export type LogLevel = keyof LogLevels;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* All loggers, keyed by name.
|
|
43
|
+
*/
|
|
44
|
+
export type AllLoggers = {
|
|
45
|
+
[name: string]: Logger;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An alias for the much used concept of a LoggerName.
|
|
50
|
+
*/
|
|
51
|
+
export type LoggerName = string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* An adapter accepts a LogFunction and returns a Logger.
|
|
55
|
+
*/
|
|
56
|
+
export type Adapter = (logfn: LogFunction) => Logger;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A logger is a log function that has a `name` that corresponds to the logger
|
|
60
|
+
* name, a method `enabledFor(level: LogLevel)` to check whether the logger is
|
|
61
|
+
* enabled for a certain log level, and log methods for each of the log levels
|
|
62
|
+
* supported by AnyLogger: `error`, `warn`, `info`, `log`, `debug` and `trace`.
|
|
63
|
+
*/
|
|
64
|
+
export type Logger = LogFunction & {
|
|
65
|
+
readonly name: LoggerName;
|
|
66
|
+
enabledFor: (level?: LogLevel) => boolean | void;
|
|
67
|
+
} & {
|
|
68
|
+
[P in keyof LogLevels as `${P}`]: LogFunction;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Gets or creates a logger by name.
|
|
73
|
+
*/
|
|
74
|
+
export type AnyLogger = ((name: LoggerName) => Logger) & {
|
|
75
|
+
/**
|
|
76
|
+
* Stores all loggers created so far.
|
|
77
|
+
*/
|
|
78
|
+
all: AllLoggers;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* An object containing a mapping of level names to level values.
|
|
82
|
+
*/
|
|
83
|
+
levels: { [level: string]: number };
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Called when a new logger needs to be created.
|
|
87
|
+
*/
|
|
88
|
+
new: (name: LoggerName) => LogFunction;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Called by the log function that the default implementation of
|
|
92
|
+
* `anylogger.new` creates.
|
|
93
|
+
*/
|
|
94
|
+
log: (name: LoggerName, ...args: any) => void;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Called when a log function needs to be extended.
|
|
98
|
+
*/
|
|
99
|
+
ext: Adapter;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Back-compat alias used by callers in this repository.
|
|
104
|
+
*/
|
|
105
|
+
export type BaseLevels = LogLevels;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* A N Y L O G G E R
|
|
109
|
+
* Get a logger. Any logger.
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
// the main `anylogger` function
|
|
113
|
+
const anylogger = ((name: LoggerName) =>
|
|
114
|
+
// return the existing logger, or
|
|
115
|
+
anylogger.all[name] ||
|
|
116
|
+
// create and store a new logger with that name
|
|
117
|
+
(anylogger.all[name] = anylogger.ext(anylogger.new(name)))) as AnyLogger;
|
|
118
|
+
|
|
119
|
+
// all loggers created so far
|
|
120
|
+
anylogger.all = Object.create(null);
|
|
121
|
+
|
|
122
|
+
// the supported levels
|
|
123
|
+
anylogger.levels = { error: 1, warn: 2, info: 3, log: 4, debug: 5, trace: 6 };
|
|
124
|
+
|
|
125
|
+
// creates a new named log function
|
|
126
|
+
anylogger.new = name =>
|
|
127
|
+
({
|
|
128
|
+
// to assign the function `name`, set it to a named key in an object.
|
|
129
|
+
// the default implementation calls `anylogger.log`, which should be a
|
|
130
|
+
// good choice in many cases.
|
|
131
|
+
[name]: (...args: any[]) => anylogger.log(name, ...args),
|
|
132
|
+
})[name]; // return only the function, not the encapsulating object
|
|
133
|
+
|
|
134
|
+
// logs with the logger with the given `name`
|
|
135
|
+
anylogger.log = (name, ...args: any[]) => {
|
|
136
|
+
// select the logger to use
|
|
137
|
+
anylogger.all[name][
|
|
138
|
+
// select the level to use
|
|
139
|
+
// if multiple args and first matches a level name
|
|
140
|
+
args.length > 1 && anylogger.levels[args[0] as string]
|
|
141
|
+
? (args.shift() as string) // use the level from the args
|
|
142
|
+
: 'log' // else use default level `'log'`
|
|
143
|
+
](...args); // call method matching level with remaining args
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// extends the given `logger` function
|
|
147
|
+
// the implementation here only adds no-ops
|
|
148
|
+
// adapters should change this behavior
|
|
149
|
+
anylogger.ext = (logger: LogFunction) => {
|
|
150
|
+
(logger as Logger).enabledFor = () => {};
|
|
151
|
+
for (const method in anylogger.levels) {
|
|
152
|
+
(logger as Logger)[method as LogLevel] = () => {};
|
|
153
|
+
}
|
|
154
|
+
return logger as Logger;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// this is a real ESM module
|
|
158
|
+
export default anylogger;
|
|
159
|
+
|
|
160
|
+
// prettier-ignore-end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"rootDir": ".",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"declarationMap": false,
|
|
9
|
+
"emitDeclarationOnly": false,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"strict": false,
|
|
12
|
+
"removeComments": false
|
|
13
|
+
},
|
|
14
|
+
"include": ["./anylogger.ts"]
|
|
15
|
+
}
|
package/exported.js
DELETED
package/src/marshal.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export function makeBoardRemote({ boardId, iface }: {
|
|
2
|
-
boardId: string | null;
|
|
3
|
-
iface?: string;
|
|
4
|
-
}): BoardRemote;
|
|
5
|
-
export function slotToBoardRemote(boardId: string, iface: string): BoardRemote;
|
|
6
|
-
export function boardSlottingMarshaller(slotToVal?: (slot: string, iface: string) => any): Omit<import("@endo/marshal").Marshal<string | null>, "serialize" | "unserialize">;
|
|
7
|
-
/**
|
|
8
|
-
* @type {TypedPattern<CapData<any>>}
|
|
9
|
-
*/
|
|
10
|
-
export const CapDataShape: TypedPattern<CapData<any>>;
|
|
11
|
-
export function assertCapData(data: unknown): asserts data is CapData<unknown>;
|
|
12
|
-
export function unmarshalFromVstorage(data: Map<string, string>, key: string, fromCapData: ReturnType<typeof import("@endo/marshal").makeMarshal>["fromCapData"], index: number): any;
|
|
13
|
-
export function makeHistoryReviver(entries: [string, string][], slotToVal?: (slot: string, iface?: string) => any): {
|
|
14
|
-
getItem: (key: string) => any;
|
|
15
|
-
children: (prefix: string) => string[];
|
|
16
|
-
has: (k: string) => boolean;
|
|
17
|
-
};
|
|
18
|
-
export const pureDataMarshaller: {
|
|
19
|
-
toCapData: import("@endo/marshal").ToCapData<CapData<unknown>>;
|
|
20
|
-
fromCapData: import("@endo/marshal").FromCapData<CapData<unknown>>;
|
|
21
|
-
serialize: import("@endo/marshal").ToCapData<CapData<unknown>>;
|
|
22
|
-
unserialize: import("@endo/marshal").FromCapData<CapData<unknown>>;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Should be a union with Remotable, but that's `any`, making this type
|
|
26
|
-
* meaningless
|
|
27
|
-
*/
|
|
28
|
-
export type BoardRemote = {
|
|
29
|
-
getBoardId: () => string | null;
|
|
30
|
-
};
|
|
31
|
-
import type { CapData } from '@endo/marshal';
|
|
32
|
-
import type { TypedPattern } from './types.js';
|
|
33
|
-
//# sourceMappingURL=marshal.d.ts.map
|
package/src/marshal.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"marshal.d.ts","sourceRoot":"","sources":["marshal.js"],"names":[],"mappings":"AAuBO,oDAHI;IAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACxC,WAAW,CAKvB;AAMM,2CAHI,MAAM,SACN,MAAM,eAGoB;AAqB9B,oDANI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG,GAClC,IAAI,CAChB,OAAW,eAAe,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAClD,WAAe,GAAG,aAAa,CAC5B,CAMH;AAGD;;GAEG;AACH,2BAFU,aAAa,QAAQ,GAAG,CAAC,CAAC,CAE+B;AAS5D,oCAHI,OAAO,GACL,QAAQ,IAAI,IAAI,QAAQ,OAAO,CAAC,CAO5C;AAeM,4CATI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,OACnB,MAAM,eACN,UAAU,CACpB,cAAkB,eAAe,EAAE,WAAW,CAC3C,CAAC,aAAa,CAAC,SACR,MAAM,GAEJ,GAAG,CAwBf;AASM,4CAHI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,cAClB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,GAAG;mBAQlC,MAAM;uBAEN,MAAM;aAYN,MAAM;EAInB;AAID;;;;;EAEG;;;;;0BA1IU;IAAE,UAAU,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;CAAE;6BARtB,eAAe;kCACV,YAAY"}
|
package/src/types.ts
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-classes-per-file */
|
|
2
|
-
import type { ERef, RemotableBrand } from '@endo/eventual-send';
|
|
3
|
-
import type { Primitive } from '@endo/pass-style';
|
|
4
|
-
import type { Pattern } from '@endo/patterns';
|
|
5
|
-
import type { Callable } from './ses-utils.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* A map corresponding with a total function such that `get(key)` is assumed to
|
|
9
|
-
* always succeed.
|
|
10
|
-
*/
|
|
11
|
-
export type TotalMap<K, V> = Omit<Map<K, V>, 'get'> & {
|
|
12
|
-
/** Returns the element associated with the specified key in the TotalMap. */
|
|
13
|
-
get: (key: K) => V;
|
|
14
|
-
};
|
|
15
|
-
export type TotalMapFrom<M extends Map<any, any>> =
|
|
16
|
-
M extends Map<infer K, infer V> ? TotalMap<K, V> : never;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* A permit is either `true` or a string (both meaning no attenuation, with a
|
|
20
|
-
* string serving as a grouping label for convenience and/or diagram
|
|
21
|
-
* generation), or an object whose keys identify child properties and whose
|
|
22
|
-
* corresponding values are theirselves (recursive) Permits.
|
|
23
|
-
*/
|
|
24
|
-
export type Permit<T> =
|
|
25
|
-
| true
|
|
26
|
-
| string
|
|
27
|
-
| Partial<{ [K in keyof T]: K extends string ? Permit<T[K]> : never }>;
|
|
28
|
-
|
|
29
|
-
export type Attenuated<T, P extends Permit<T>> = P extends object
|
|
30
|
-
? {
|
|
31
|
-
[K in keyof P]: K extends keyof T
|
|
32
|
-
? P[K] extends Permit<T[K]>
|
|
33
|
-
? Attenuated<T[K], P[K]>
|
|
34
|
-
: never
|
|
35
|
-
: never;
|
|
36
|
-
}
|
|
37
|
-
: T;
|
|
38
|
-
|
|
39
|
-
export declare class Callback<I extends (...args: any[]) => any> {
|
|
40
|
-
private iface: I;
|
|
41
|
-
|
|
42
|
-
public target: any;
|
|
43
|
-
|
|
44
|
-
public methodName?: PropertyKey;
|
|
45
|
-
|
|
46
|
-
public bound: unknown[];
|
|
47
|
-
|
|
48
|
-
public isSync: boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export declare class SyncCallback<
|
|
52
|
-
I extends (...args: unknown[]) => any,
|
|
53
|
-
> extends Callback<I> {
|
|
54
|
-
private syncIface: I;
|
|
55
|
-
|
|
56
|
-
public isSync: true;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
Returns a boolean for whether the given type is primitive value or primitive type.
|
|
61
|
-
|
|
62
|
-
@example
|
|
63
|
-
```
|
|
64
|
-
IsPrimitive<'string'>
|
|
65
|
-
//=> true
|
|
66
|
-
|
|
67
|
-
IsPrimitive<string>
|
|
68
|
-
//=> true
|
|
69
|
-
|
|
70
|
-
IsPrimitive<Object>
|
|
71
|
-
//=> false
|
|
72
|
-
```
|
|
73
|
-
*/
|
|
74
|
-
export type IsPrimitive<T> = [T] extends [Primitive] ? true : false;
|
|
75
|
-
|
|
76
|
-
/** Recursively extract the non-callable properties of T */
|
|
77
|
-
export type DataOnly<T> =
|
|
78
|
-
IsPrimitive<T> extends true
|
|
79
|
-
? T
|
|
80
|
-
: T extends Callable
|
|
81
|
-
? never
|
|
82
|
-
: { [P in keyof T as T[P] extends Callable ? never : P]: DataOnly<T[P]> };
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* A type that doesn't assume its parameter is local, but is satisfied with both
|
|
86
|
-
* local and remote references. It accepts both near and marshalled references
|
|
87
|
-
* that were returned from `Remotable` or `Far`.
|
|
88
|
-
*/
|
|
89
|
-
export type Remote<Primary, Local = DataOnly<Primary>> =
|
|
90
|
-
| Primary
|
|
91
|
-
| RemotableBrand<Local, Primary>;
|
|
92
|
-
|
|
93
|
-
// TODO: Add type tests for FarRef and Remote.
|
|
94
|
-
/**
|
|
95
|
-
* Potentially remote promises or settled references.
|
|
96
|
-
*/
|
|
97
|
-
export type FarRef<Primary, Local = DataOnly<Primary>> = ERef<
|
|
98
|
-
Remote<Primary, Local>
|
|
99
|
-
>;
|
|
100
|
-
|
|
101
|
-
/*
|
|
102
|
-
* Stop-gap until https://github.com/Agoric/agoric-sdk/issues/6160
|
|
103
|
-
* explictly specify the type that the Pattern will verify through a match.
|
|
104
|
-
*
|
|
105
|
-
* TODO move all this pattern typing stuff to @endo/patterns
|
|
106
|
-
*/
|
|
107
|
-
declare const validatedType: unique symbol;
|
|
108
|
-
/**
|
|
109
|
-
* Tag a pattern with the static type it represents.
|
|
110
|
-
*/
|
|
111
|
-
export type TypedPattern<T> = Pattern & { [validatedType]?: T };
|
|
112
|
-
|
|
113
|
-
export declare type PatternType<TM extends TypedPattern<any>> =
|
|
114
|
-
TM extends TypedPattern<infer T> ? T : never;
|
|
115
|
-
|
|
116
|
-
// TODO make Endo's mustMatch do this
|
|
117
|
-
/**
|
|
118
|
-
* Returning normally indicates success. Match failure is indicated by
|
|
119
|
-
* throwing.
|
|
120
|
-
*
|
|
121
|
-
* Note: remotables can only be matched as "remotable", not the specific kind.
|
|
122
|
-
*
|
|
123
|
-
* @see {import('@endo/patterns').mustMatch} for the implementation. This one has a type annotation to narrow if the pattern is a TypedPattern.
|
|
124
|
-
*/
|
|
125
|
-
export declare type MustMatch = <P extends Pattern>(
|
|
126
|
-
specimen: unknown,
|
|
127
|
-
pattern: P,
|
|
128
|
-
label?: string | number,
|
|
129
|
-
) => asserts specimen is P extends TypedPattern<any> ? PatternType<P> : unknown;
|