@metamask-previews/messenger 2.0.0-preview-4f4c98e → 2.0.0-preview-eb263b0ee
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/CHANGELOG.md +0 -4
- package/dist/Messenger.cjs +702 -0
- package/dist/Messenger.cjs.map +1 -0
- package/dist/{Messenger.d.ts → Messenger.d.cts} +1 -1
- package/dist/Messenger.d.cts.map +1 -0
- package/dist/Messenger.d.mts +587 -0
- package/dist/Messenger.d.mts.map +1 -0
- package/dist/{Messenger.js → Messenger.mjs} +1 -1
- package/dist/Messenger.mjs.map +1 -0
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.ts → index.d.cts} +3 -3
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +17 -13
- package/dist/Messenger.d.ts.map +0 -1
- package/dist/Messenger.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
export type ActionHandler<Action extends ActionConstraint, ActionType = Action['type']> = (...args: ExtractActionParameters<Action, ActionType>) => ExtractActionResponse<Action, ActionType>;
|
|
2
|
+
export type ExtractActionParameters<Action extends ActionConstraint, ActionType = Action['type']> = Action extends {
|
|
3
|
+
type: ActionType;
|
|
4
|
+
handler: (...args: infer HandlerArgs) => unknown;
|
|
5
|
+
} ? HandlerArgs : never;
|
|
6
|
+
export type ExtractActionResponse<Action extends ActionConstraint, ActionType = Action['type']> = Action extends {
|
|
7
|
+
type: ActionType;
|
|
8
|
+
handler: (...args: infer _) => infer HandlerReturnValue;
|
|
9
|
+
} ? HandlerReturnValue : never;
|
|
10
|
+
export type ExtractEventHandler<Event extends EventConstraint, EventType = Event['type']> = Event extends {
|
|
11
|
+
type: EventType;
|
|
12
|
+
payload: infer Payload;
|
|
13
|
+
} ? Payload extends unknown[] ? (...payload: Payload) => void : never : never;
|
|
14
|
+
export type ExtractEventPayload<Event extends EventConstraint, EventType = Event['type']> = Event extends {
|
|
15
|
+
type: EventType;
|
|
16
|
+
payload: infer Payload;
|
|
17
|
+
} ? Payload extends unknown[] ? Payload : never : never;
|
|
18
|
+
export type GenericEventHandler = (...args: unknown[]) => void;
|
|
19
|
+
export type SelectorFunction<Event extends EventConstraint, EventType extends Event['type'], ReturnValue = unknown> = (...args: ExtractEventPayload<Event, EventType>) => ReturnValue;
|
|
20
|
+
export type SelectorEventHandler<SelectorReturnValue = unknown> = (newValue: SelectorReturnValue, previousValue: SelectorReturnValue | undefined) => void;
|
|
21
|
+
export type ActionConstraint = {
|
|
22
|
+
type: NamespacedName;
|
|
23
|
+
handler: ((...args: never) => unknown) | ((...args: never[]) => unknown);
|
|
24
|
+
};
|
|
25
|
+
export type EventConstraint = {
|
|
26
|
+
type: NamespacedName;
|
|
27
|
+
payload: unknown[];
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Extract action types from a Messenger type.
|
|
31
|
+
*
|
|
32
|
+
* @template Subject - The messenger type to extract from.
|
|
33
|
+
*/
|
|
34
|
+
export type MessengerActions<Subject extends Messenger<string, ActionConstraint, EventConstraint>> = Subject extends Messenger<string, infer Action, EventConstraint> ? Action : never;
|
|
35
|
+
/**
|
|
36
|
+
* Extract event types from a Messenger type.
|
|
37
|
+
*
|
|
38
|
+
* @template Subject - The messenger type to extract from.
|
|
39
|
+
*/
|
|
40
|
+
export type MessengerEvents<Subject extends Messenger<string, ActionConstraint, EventConstraint>> = Subject extends Messenger<string, ActionConstraint, infer Event> ? Event : never;
|
|
41
|
+
/**
|
|
42
|
+
* Extract the namespace from a Messenger type.
|
|
43
|
+
*
|
|
44
|
+
* @template Subject - The messenger type to extract from.
|
|
45
|
+
*/
|
|
46
|
+
export type MessengerNamespace<Subject extends Messenger<string, ActionConstraint, EventConstraint>> = Subject extends Messenger<infer N, ActionConstraint, EventConstraint> ? N : never;
|
|
47
|
+
/**
|
|
48
|
+
* Validate that all members of a union are present in a tuple.
|
|
49
|
+
*
|
|
50
|
+
* When all required members are present, evaluates to the input tuple unchanged.
|
|
51
|
+
* When members are missing, evaluates to a branded intersection type that
|
|
52
|
+
* produces a clear compile error showing exactly which items are missing via
|
|
53
|
+
* the `__MISSING_DELEGATIONS__` property.
|
|
54
|
+
*
|
|
55
|
+
* @template Required - The union of all required string types.
|
|
56
|
+
* @template Provided - The readonly tuple of provided string types.
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* // OK — all required items present
|
|
60
|
+
* type T1 = RequireExhaustive<'A' | 'B', readonly ['A', 'B']>;
|
|
61
|
+
* // => readonly ['A', 'B']
|
|
62
|
+
*
|
|
63
|
+
* // Error — 'C' is missing
|
|
64
|
+
* type T2 = RequireExhaustive<'A' | 'B' | 'C', readonly ['A', 'B']>;
|
|
65
|
+
* // => readonly ['A', 'B'] & { __MISSING_DELEGATIONS__: 'C' }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
type RequireExhaustive<Required extends string, Provided extends readonly string[]> = [Exclude<Required, Provided[number]>] extends [never] ? Provided : // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
69
|
+
Provided & {
|
|
70
|
+
__MISSING_DELEGATIONS__: Exclude<Required, Provided[number]>;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Messenger namespace checks can be disabled by using this as the `namespace` constructor
|
|
74
|
+
* parameter, and using `MockAnyNamespace` as the Namespace type parameter.
|
|
75
|
+
*
|
|
76
|
+
* This is useful for mocking a variety of different actions/events in unit tests. Please do not
|
|
77
|
+
* use this in production code.
|
|
78
|
+
*/
|
|
79
|
+
export declare const MOCK_ANY_NAMESPACE = "MOCK_ANY_NAMESPACE";
|
|
80
|
+
/**
|
|
81
|
+
* A type representing any namespace.
|
|
82
|
+
*
|
|
83
|
+
* This is useful for mocking a variety of different actions/events in unit tests. Please do not
|
|
84
|
+
* use this in production code.
|
|
85
|
+
*/
|
|
86
|
+
export type MockAnyNamespace = string;
|
|
87
|
+
/**
|
|
88
|
+
* A namespaced string
|
|
89
|
+
*
|
|
90
|
+
* This type verifies that the string Name is prefixed by the string Name followed by a colon.
|
|
91
|
+
*
|
|
92
|
+
* @template Namespace - The namespace we're checking for.
|
|
93
|
+
* @template Name - The full string, including the namespace.
|
|
94
|
+
*/
|
|
95
|
+
export type NamespacedBy<Namespace extends string, Name extends string> = Name extends `${Namespace}:${string}` ? Name : never;
|
|
96
|
+
export type NotNamespacedBy<Namespace extends string, Name extends string> = Name extends `${Namespace}:${string}` ? never : Name;
|
|
97
|
+
export type NamespacedName<Namespace extends string = string> = `${Namespace}:${string}`;
|
|
98
|
+
type StripNamespace<Namespaced extends NamespacedName> = Namespaced extends `${string}:${infer Name}` ? Name : never;
|
|
99
|
+
/**
|
|
100
|
+
* A message broker for "actions" and "events".
|
|
101
|
+
*
|
|
102
|
+
* The messenger allows registering functions as 'actions' that can be called elsewhere,
|
|
103
|
+
* and it allows publishing and subscribing to events. Both actions and events are identified by
|
|
104
|
+
* unique strings prefixed by a namespace (which is delimited by a colon, e.g.
|
|
105
|
+
* `Namespace:actionName`).
|
|
106
|
+
*
|
|
107
|
+
* @template Action - A type union of all Action types.
|
|
108
|
+
* @template Event - A type union of all Event types.
|
|
109
|
+
* @template Namespace - The namespace for the messenger.
|
|
110
|
+
*/
|
|
111
|
+
export declare class Messenger<Namespace extends string, Action extends ActionConstraint = never, Event extends EventConstraint = never, Parent extends Messenger<string, ActionConstraint, EventConstraint, any> = never> {
|
|
112
|
+
#private;
|
|
113
|
+
/**
|
|
114
|
+
* Reports an error to an error monitoring service.
|
|
115
|
+
*
|
|
116
|
+
* @param error - The error to report.
|
|
117
|
+
*/
|
|
118
|
+
readonly captureException?: (error: Error) => void;
|
|
119
|
+
/**
|
|
120
|
+
* Construct a messenger.
|
|
121
|
+
*
|
|
122
|
+
* If a parent messenger is given, all actions and events under this messenger's namespace will
|
|
123
|
+
* be delegated to the parent automatically.
|
|
124
|
+
*
|
|
125
|
+
* @param args - Constructor arguments
|
|
126
|
+
* @param args.captureException - Reports an error to an error monitoring service.
|
|
127
|
+
* @param args.namespace - The messenger namespace.
|
|
128
|
+
* @param args.parent - The parent messenger.
|
|
129
|
+
*/
|
|
130
|
+
constructor({ captureException, namespace, parent, }: {
|
|
131
|
+
captureException?: (error: Error) => void;
|
|
132
|
+
namespace: Namespace;
|
|
133
|
+
parent?: Action['type'] extends MessengerActions<Parent>['type'] ? Event['type'] extends MessengerEvents<Parent>['type'] ? Parent : never : never;
|
|
134
|
+
});
|
|
135
|
+
/**
|
|
136
|
+
* Register an action handler.
|
|
137
|
+
*
|
|
138
|
+
* This will make the registered function available to call via the `call` method.
|
|
139
|
+
*
|
|
140
|
+
* The action being registered must be under the same namespace as the messenger.
|
|
141
|
+
*
|
|
142
|
+
* @param actionType - The action type. This is a unique identifier for this action.
|
|
143
|
+
* @param handler - The action handler. This function gets called when the `call` method is
|
|
144
|
+
* invoked with the given action type.
|
|
145
|
+
* @throws Will throw when a handler has been registered for this action type already.
|
|
146
|
+
* @template ActionType - A type union of Action type strings under this messenger's namespace.
|
|
147
|
+
*/
|
|
148
|
+
registerActionHandler<ActionType extends Action['type'] & NamespacedName<Namespace>>(actionType: ActionType, handler: ActionHandler<Action, ActionType>): void;
|
|
149
|
+
/**
|
|
150
|
+
* Registers action handlers for a list of methods on a messenger client
|
|
151
|
+
*
|
|
152
|
+
* @param messengerClient - The object that is expected to make use of the messenger.
|
|
153
|
+
* @param methodNames - The names of the methods on the messenger client to register as action
|
|
154
|
+
* handlers.
|
|
155
|
+
* @template MessengerClient - The type expected to make use of the messenger.
|
|
156
|
+
* @template MethodNames - The type union of method names to register as action handlers.
|
|
157
|
+
*/
|
|
158
|
+
registerMethodActionHandlers<MessengerClient extends {
|
|
159
|
+
name: Namespace;
|
|
160
|
+
}, MethodNames extends keyof MessengerClient & StripNamespace<Action['type']>>(messengerClient: MessengerClient, methodNames: readonly MethodNames[]): void;
|
|
161
|
+
/**
|
|
162
|
+
* Unregister an action handler.
|
|
163
|
+
*
|
|
164
|
+
* This will prevent this action from being called.
|
|
165
|
+
*
|
|
166
|
+
* The action being unregistered must be under the same namespace as the messenger.
|
|
167
|
+
*
|
|
168
|
+
* @param actionType - The action type. This is a unique identifier for this action.
|
|
169
|
+
* @template ActionType - A type union of Action type strings under this messenger's namespace.
|
|
170
|
+
*/
|
|
171
|
+
unregisterActionHandler<ActionType extends Action['type'] & NamespacedName<Namespace>>(actionType: ActionType): void;
|
|
172
|
+
/**
|
|
173
|
+
* Unregister all action handlers.
|
|
174
|
+
*
|
|
175
|
+
* This prevents all actions from being called.
|
|
176
|
+
*/
|
|
177
|
+
clearActions(): void;
|
|
178
|
+
/**
|
|
179
|
+
* Get the types of all actions that this messenger can call directly.
|
|
180
|
+
*
|
|
181
|
+
* This includes actions registered on this messenger as well as actions that
|
|
182
|
+
* have been delegated to it from another messenger.
|
|
183
|
+
*
|
|
184
|
+
* Note that this reflects the registrations on this specific messenger
|
|
185
|
+
* instance.
|
|
186
|
+
*
|
|
187
|
+
* @returns An array of every action type this messenger can call directly.
|
|
188
|
+
*/
|
|
189
|
+
getRegisteredActionTypes(): string[];
|
|
190
|
+
/**
|
|
191
|
+
* Get the action handler for a given action type.
|
|
192
|
+
*
|
|
193
|
+
* This is a protected method to allow subclasses to override the way action
|
|
194
|
+
* handlers are retrieved, for example to implement custom delegation logic.
|
|
195
|
+
*
|
|
196
|
+
* @param actionType - The action type. This is a unique identifier for this
|
|
197
|
+
* action.
|
|
198
|
+
* @returns The action handler for the given action type, or undefined if no
|
|
199
|
+
* handler has been registered.
|
|
200
|
+
*/
|
|
201
|
+
protected getAction(actionType: Action['type']): ActionConstraint['handler'] | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* Create a new messenger as a child of this messenger (the "parent").
|
|
204
|
+
* All actions/events are delegated from the child to the parent, and the specified actions/events are delegated from the parent to the child.
|
|
205
|
+
*
|
|
206
|
+
* @param args - Arguments.
|
|
207
|
+
* @param args.namespace - The child messenger namespace.
|
|
208
|
+
* @param args.actions - A list of action types to delegate to the child messenger.
|
|
209
|
+
* @param args.events - A list of event types to delegate to the child messenger.
|
|
210
|
+
* @returns The child messenger.
|
|
211
|
+
*/
|
|
212
|
+
buildChild<ChildNamespace extends string, ChildAction extends Action, ChildEvent extends Event>({ namespace, actions, events, }: {
|
|
213
|
+
namespace: ChildNamespace;
|
|
214
|
+
actions?: ChildAction['type'][];
|
|
215
|
+
events?: ChildEvent['type'][];
|
|
216
|
+
}): Messenger<ChildNamespace, ChildAction, ChildEvent>;
|
|
217
|
+
/**
|
|
218
|
+
* Call an action.
|
|
219
|
+
*
|
|
220
|
+
* This function will call the action handler corresponding to the given action type, passing
|
|
221
|
+
* along any parameters given.
|
|
222
|
+
*
|
|
223
|
+
* @param actionType - The action type. This is a unique identifier for this action.
|
|
224
|
+
* @param params - The action parameters. These must match the type of the parameters of the
|
|
225
|
+
* registered action handler.
|
|
226
|
+
* @throws Will throw when no handler has been registered for the given type.
|
|
227
|
+
* @template ActionType - A type union of Action type strings.
|
|
228
|
+
* @returns The action return value.
|
|
229
|
+
*/
|
|
230
|
+
call<ActionType extends Action['type']>(actionType: ActionType, ...params: ExtractActionParameters<Action, ActionType>): ExtractActionResponse<Action, ActionType>;
|
|
231
|
+
/**
|
|
232
|
+
* Register a function for getting the initial payload for an event.
|
|
233
|
+
*
|
|
234
|
+
* This is used for events that represent a state change, where the payload is the state.
|
|
235
|
+
* Registering a function for getting the payload allows event selectors to have a point of
|
|
236
|
+
* comparison the first time state changes.
|
|
237
|
+
*
|
|
238
|
+
* The event type must be under the same namespace as the messenger.
|
|
239
|
+
*
|
|
240
|
+
* @param args - The arguments to this function
|
|
241
|
+
* @param args.eventType - The event type to register a payload for.
|
|
242
|
+
* @param args.getPayload - A function for retrieving the event payload.
|
|
243
|
+
* @template EventType - A type union of Event type strings under this messenger's namespace.
|
|
244
|
+
*/
|
|
245
|
+
registerInitialEventPayload<EventType extends Event['type'] & NamespacedName<Namespace>>({ eventType, getPayload, }: {
|
|
246
|
+
eventType: EventType;
|
|
247
|
+
getPayload: () => ExtractEventPayload<Event, EventType>;
|
|
248
|
+
}): void;
|
|
249
|
+
/**
|
|
250
|
+
* Publish an event.
|
|
251
|
+
*
|
|
252
|
+
* Publishes the given payload to all subscribers of the given event type.
|
|
253
|
+
*
|
|
254
|
+
* Note that this method should never throw directly. Any errors from
|
|
255
|
+
* subscribers are captured and re-thrown in a timeout handler.
|
|
256
|
+
*
|
|
257
|
+
* The event being published must be under the same namespace as the messenger.
|
|
258
|
+
*
|
|
259
|
+
* @param eventType - The event type. This is a unique identifier for this event.
|
|
260
|
+
* @param payload - The event payload. The type of the parameters for each event handler must
|
|
261
|
+
* match the type of this payload.
|
|
262
|
+
* @template EventType - A type union of Event type strings under this messenger's namespace.
|
|
263
|
+
*/
|
|
264
|
+
publish<EventType extends Event['type'] & NamespacedName<Namespace>>(eventType: EventType & NamespacedName<Namespace>, ...payload: ExtractEventPayload<Event, EventType>): void;
|
|
265
|
+
/**
|
|
266
|
+
* Subscribe to an event.
|
|
267
|
+
*
|
|
268
|
+
* Registers the given function as an event handler for the given event type.
|
|
269
|
+
*
|
|
270
|
+
* @param eventType - The event type. This is a unique identifier for this event.
|
|
271
|
+
* @param handler - The event handler. The type of the parameters for this event handler must
|
|
272
|
+
* match the type of the payload for this event type.
|
|
273
|
+
* @template EventType - A type union of Event type strings.
|
|
274
|
+
*/
|
|
275
|
+
subscribe<EventType extends Event['type']>(eventType: EventType, handler: ExtractEventHandler<Event, EventType>): void;
|
|
276
|
+
/**
|
|
277
|
+
* Subscribe to an event, with a selector.
|
|
278
|
+
*
|
|
279
|
+
* Registers the given handler function as an event handler for the given
|
|
280
|
+
* event type. When an event is published, its payload is first passed to the
|
|
281
|
+
* selector. The event handler is only called if the selector's return value
|
|
282
|
+
* differs from its last known return value.
|
|
283
|
+
*
|
|
284
|
+
* @param eventType - The event type. This is a unique identifier for this event.
|
|
285
|
+
* @param handler - The event handler. The type of the parameters for this event
|
|
286
|
+
* handler must match the return type of the selector.
|
|
287
|
+
* @param selector - The selector function used to select relevant data from
|
|
288
|
+
* the event payload. The type of the parameters for this selector must match
|
|
289
|
+
* the type of the payload for this event type.
|
|
290
|
+
* @template EventType - A type union of Event type strings.
|
|
291
|
+
* @template SelectorReturnValue - The selector return value.
|
|
292
|
+
*/
|
|
293
|
+
subscribe<EventType extends Event['type'], SelectorReturnValue>(eventType: EventType, handler: SelectorEventHandler<SelectorReturnValue>, selector: SelectorFunction<Event, EventType, SelectorReturnValue>): void;
|
|
294
|
+
/**
|
|
295
|
+
* Subscribe to an event, with a selector, invoking the handler exactly once.
|
|
296
|
+
*
|
|
297
|
+
* Registers the given handler function as an event handler for the given
|
|
298
|
+
* event type. When an event is published, its payload is first passed to the
|
|
299
|
+
* selector. The event handler is only called if the selector's return value
|
|
300
|
+
* differs from its last known return value. Additionally if the optional condition
|
|
301
|
+
* function is provided, it is checked whether it returns `true`.
|
|
302
|
+
* The handler is invoked at most once, after which the subscription is removed.
|
|
303
|
+
*
|
|
304
|
+
* @param eventType - The event type. This is a unique identifier for this event.
|
|
305
|
+
* @param handler - The event handler. The type of the parameters for this event
|
|
306
|
+
* handler must match the return type of the selector.
|
|
307
|
+
* @param options - Options bag.
|
|
308
|
+
* @param options.selector - The selector function used to select relevant data
|
|
309
|
+
* from the event payload. The type of the parameters for this selector must
|
|
310
|
+
* match the type of the payload for this event type.
|
|
311
|
+
* @param options.condition - An optional predicate evaluated against the
|
|
312
|
+
* selector's return value. The handler is only invoked when this returns `true`.
|
|
313
|
+
* @template EventType - A type union of Event type strings.
|
|
314
|
+
* @template SelectorReturnValue - The selector return value.
|
|
315
|
+
* @example
|
|
316
|
+
* ```typescript
|
|
317
|
+
* messenger.subscribeOnce(
|
|
318
|
+
* 'TransactionController:transactionConfirmed',
|
|
319
|
+
* (hash) => { ... },
|
|
320
|
+
* { selector: (tx) => tx.hash, condition: (hash) => hash === 'foo' },
|
|
321
|
+
* );
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
subscribeOnce<EventType extends Event['type'], SelectorReturnValue>(eventType: EventType, handler: SelectorEventHandler<SelectorReturnValue>, options: {
|
|
325
|
+
selector: SelectorFunction<Event, EventType, SelectorReturnValue>;
|
|
326
|
+
condition?: (value: SelectorReturnValue) => boolean;
|
|
327
|
+
}): void;
|
|
328
|
+
/**
|
|
329
|
+
* Subscribe to an event, invoking the handler exactly once.
|
|
330
|
+
*
|
|
331
|
+
* Registers the given function as an event handler for the given event type
|
|
332
|
+
* and automatically unsubscribes after the first invocation.
|
|
333
|
+
*
|
|
334
|
+
* If `options.condition` is provided, the handler is only invoked (and the
|
|
335
|
+
* subscription only removed) when the condition returns `true`.
|
|
336
|
+
*
|
|
337
|
+
* @param eventType - The event type. This is a unique identifier for this event.
|
|
338
|
+
* @param handler - The event handler. The type of the parameters for this event
|
|
339
|
+
* handler must match the type of the payload for this event type.
|
|
340
|
+
* @param options - Options bag.
|
|
341
|
+
* @param options.condition - A predicate evaluated against the event payload.
|
|
342
|
+
* The handler is only invoked when this returns `true`.
|
|
343
|
+
* @template EventType - A type union of Event type strings.
|
|
344
|
+
* @example
|
|
345
|
+
* ```typescript
|
|
346
|
+
* messenger.subscribeOnce(
|
|
347
|
+
* 'TransactionController:transactionConfirmed',
|
|
348
|
+
* (tx) => { ... },
|
|
349
|
+
* { condition: (tx) => tx.hash === 'foo' },
|
|
350
|
+
* );
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
subscribeOnce<EventType extends Event['type']>(eventType: EventType, handler: ExtractEventHandler<Event, EventType>, options?: {
|
|
354
|
+
condition?: (...payload: ExtractEventPayload<Event, EventType>) => boolean;
|
|
355
|
+
}): void;
|
|
356
|
+
/**
|
|
357
|
+
* Return a promise that resolves the next time the selector's return value
|
|
358
|
+
* changes and, if provided, the `options.condition` predicate returns `true`.
|
|
359
|
+
*
|
|
360
|
+
* @param eventType - The event type. This is a unique identifier for this event.
|
|
361
|
+
* @param options - Options bag.
|
|
362
|
+
* @param options.selector - The selector function used to select relevant data
|
|
363
|
+
* from the event payload.
|
|
364
|
+
* @param options.condition - An optional predicate evaluated against the
|
|
365
|
+
* selector's return value. The promise only resolves when this returns `true`.
|
|
366
|
+
* @template EventType - A type union of Event type strings.
|
|
367
|
+
* @template SelectorReturnValue - The selector return value.
|
|
368
|
+
* @returns A promise that resolves with the selector's return value.
|
|
369
|
+
* @example
|
|
370
|
+
* ```typescript
|
|
371
|
+
* const [hash] = await messenger.waitUntil(
|
|
372
|
+
* 'TransactionController:transactionConfirmed',
|
|
373
|
+
* { selector: (tx) => tx.hash, condition: (hash) => hash === 'foo' },
|
|
374
|
+
* );
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
waitUntil<EventType extends Event['type'], SelectorReturnValue>(eventType: EventType, options: {
|
|
378
|
+
selector: SelectorFunction<Event, EventType, SelectorReturnValue>;
|
|
379
|
+
condition?: (value: SelectorReturnValue) => boolean;
|
|
380
|
+
}): Promise<[SelectorReturnValue, SelectorReturnValue | undefined]>;
|
|
381
|
+
/**
|
|
382
|
+
* Return a promise that resolves the next time the given event is published.
|
|
383
|
+
*
|
|
384
|
+
* If `options.condition` is provided, the promise only resolves when the
|
|
385
|
+
* condition returns `true`.
|
|
386
|
+
*
|
|
387
|
+
* @param eventType - The event type. This is a unique identifier for this event.
|
|
388
|
+
* @param options - Options bag.
|
|
389
|
+
* @param options.condition - A predicate evaluated against the event payload.
|
|
390
|
+
* The promise only resolves when this returns `true`.
|
|
391
|
+
* @template EventType - A type union of Event type strings.
|
|
392
|
+
* @returns A promise that resolves with the event payload.
|
|
393
|
+
* @example
|
|
394
|
+
* ```typescript
|
|
395
|
+
* const [transactionMeta] = await messenger.waitUntil(
|
|
396
|
+
* 'TransactionController:transactionConfirmed',
|
|
397
|
+
* { condition: (tx) => tx.hash === 'foo' },
|
|
398
|
+
* );
|
|
399
|
+
* ```
|
|
400
|
+
* @example
|
|
401
|
+
* ```typescript
|
|
402
|
+
* await messenger.waitUntil('KeyringController:unlock');
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
waitUntil<EventType extends Event['type']>(eventType: EventType, options?: {
|
|
406
|
+
condition?: (...payload: ExtractEventPayload<Event, EventType>) => boolean;
|
|
407
|
+
}): Promise<ExtractEventPayload<Event, EventType>>;
|
|
408
|
+
/**
|
|
409
|
+
* Unsubscribe from an event.
|
|
410
|
+
*
|
|
411
|
+
* Unregisters the given function as an event handler for the given event.
|
|
412
|
+
*
|
|
413
|
+
* @param eventType - The event type. This is a unique identifier for this event.
|
|
414
|
+
* @param handler - The event handler to unregister.
|
|
415
|
+
* @throws Will throw when the given event handler is not registered for this event.
|
|
416
|
+
* @template EventType - A type union of Event type strings.
|
|
417
|
+
* @template SelectorReturnValue - The selector return value.
|
|
418
|
+
*/
|
|
419
|
+
unsubscribe<EventType extends Event['type'], SelectorReturnValue = unknown>(eventType: EventType, handler: ExtractEventHandler<Event, EventType> | SelectorEventHandler<SelectorReturnValue>): void;
|
|
420
|
+
/**
|
|
421
|
+
* Clear subscriptions for a specific event.
|
|
422
|
+
*
|
|
423
|
+
* This will remove all subscribed handlers for this event registered from this messenger. The
|
|
424
|
+
* event may still have subscribers if it has been delegated to another messenger.
|
|
425
|
+
*
|
|
426
|
+
* @param eventType - The event type. This is a unique identifier for this event.
|
|
427
|
+
* @template EventType - A type union of Event type strings.
|
|
428
|
+
*/
|
|
429
|
+
clearEventSubscriptions<EventType extends Event['type']>(eventType: EventType): void;
|
|
430
|
+
/**
|
|
431
|
+
* Clear all subscriptions.
|
|
432
|
+
*
|
|
433
|
+
* This will remove all subscribed handlers for all events registered from this messenger. Events
|
|
434
|
+
* may still have subscribers if they are delegated to another messenger.
|
|
435
|
+
*/
|
|
436
|
+
clearSubscriptions(): void;
|
|
437
|
+
/**
|
|
438
|
+
* Delegate actions and/or events to another messenger.
|
|
439
|
+
*
|
|
440
|
+
* The messenger these actions/events are delegated to will be able to call these actions and
|
|
441
|
+
* subscribe to these events.
|
|
442
|
+
*
|
|
443
|
+
* Note that the messenger these actions/events are delegated to must still have these
|
|
444
|
+
* actions/events included in its type definition (as part of the Action and Event type
|
|
445
|
+
* parameters). Actions and events are statically type checked, they cannot be delegated
|
|
446
|
+
* dynamically at runtime.
|
|
447
|
+
*
|
|
448
|
+
* @param args - Arguments.
|
|
449
|
+
* @param args.actions - The action types to delegate.
|
|
450
|
+
* @param args.events - The event types to delegate.
|
|
451
|
+
* @param args.messenger - The messenger to delegate to.
|
|
452
|
+
* @template Delegatee - The messenger the actions/events are delegated to.
|
|
453
|
+
* @template DelegatedActions - An array of delegated action types.
|
|
454
|
+
* @template DelegatedEvents - An array of delegated event types.
|
|
455
|
+
*/
|
|
456
|
+
delegate<Delegatee extends Messenger<string, ActionConstraint, EventConstraint>, DelegatedActions extends (MessengerActions<Delegatee>['type'] & Action['type'])[], DelegatedEvents extends (MessengerEvents<Delegatee>['type'] & Event['type'])[]>({ actions, events, messenger, }: {
|
|
457
|
+
actions?: DelegatedActions;
|
|
458
|
+
events?: DelegatedEvents;
|
|
459
|
+
messenger: Delegatee;
|
|
460
|
+
}): void;
|
|
461
|
+
/**
|
|
462
|
+
* Delegate all external actions and events to another messenger, with
|
|
463
|
+
* compile-time exhaustiveness checking.
|
|
464
|
+
*
|
|
465
|
+
* Unlike {@link delegate}, which accepts a partial list of actions/events,
|
|
466
|
+
* this method requires that **every** action and event the delegatee needs
|
|
467
|
+
* from outside its own namespace is included. If any are missing, TypeScript
|
|
468
|
+
* produces a type error showing the missing items.
|
|
469
|
+
*
|
|
470
|
+
* The source messenger's action/event types must include every required
|
|
471
|
+
* external item. Items the source cannot provide still appear in the
|
|
472
|
+
* missing set, so incomplete source typing fails loudly instead of being
|
|
473
|
+
* silently skipped.
|
|
474
|
+
*
|
|
475
|
+
* Use this when a single source messenger provides all external
|
|
476
|
+
* actions/events for a child messenger (the common pattern in controller
|
|
477
|
+
* initialisation).
|
|
478
|
+
*
|
|
479
|
+
* @param args - Arguments.
|
|
480
|
+
* @param args.actions - The action types to delegate. Must include every
|
|
481
|
+
* action type defined on the delegatee that is **not** under its own
|
|
482
|
+
* namespace.
|
|
483
|
+
* @param args.events - The event types to delegate. Must include every event
|
|
484
|
+
* type defined on the delegatee that is **not** under its own namespace.
|
|
485
|
+
* @param args.messenger - The messenger to delegate to.
|
|
486
|
+
* @template Delegatee - The messenger the actions/events are delegated to.
|
|
487
|
+
* @template DelegatedActions - An array of delegated action type strings.
|
|
488
|
+
* @template DelegatedEvents - An array of delegated event type strings.
|
|
489
|
+
*/
|
|
490
|
+
delegateAll<Delegatee extends Messenger<string, ActionConstraint, EventConstraint>, DelegatedActions extends (MessengerActions<Delegatee>['type'] & Action['type'])[], DelegatedEvents extends (MessengerEvents<Delegatee>['type'] & Event['type'])[]>({ actions, events, messenger, }: {
|
|
491
|
+
messenger: Delegatee;
|
|
492
|
+
actions: RequireExhaustive<NotNamespacedBy<MessengerNamespace<Delegatee>, MessengerActions<Delegatee>['type']>, DelegatedActions>;
|
|
493
|
+
events: RequireExhaustive<NotNamespacedBy<MessengerNamespace<Delegatee>, MessengerEvents<Delegatee>['type']>, DelegatedEvents>;
|
|
494
|
+
}): void;
|
|
495
|
+
/**
|
|
496
|
+
* Revoke delegated actions and/or events from another messenger.
|
|
497
|
+
*
|
|
498
|
+
* The messenger these actions/events are delegated to will no longer be able to call these
|
|
499
|
+
* actions or subscribe to these events.
|
|
500
|
+
*
|
|
501
|
+
* @param args - Arguments.
|
|
502
|
+
* @param args.actions - The action types to revoke.
|
|
503
|
+
* @param args.events - The event types to revoke.
|
|
504
|
+
* @param args.messenger - The messenger these actions/events were delegated to.
|
|
505
|
+
* @template Delegatee - The messenger the actions/events are being revoked from.
|
|
506
|
+
* @template DelegatedActions - An array of delegated action types.
|
|
507
|
+
* @template DelegatedEvents - An array of delegated event types.
|
|
508
|
+
*/
|
|
509
|
+
revoke<Delegatee extends Messenger<string, ActionConstraint, EventConstraint>, DelegatedActions extends (MessengerActions<Delegatee>['type'] & Action['type'])[], DelegatedEvents extends (MessengerEvents<Delegatee>['type'] & Event['type'])[]>({ actions, events, messenger, }: {
|
|
510
|
+
actions?: DelegatedActions;
|
|
511
|
+
events?: DelegatedEvents;
|
|
512
|
+
messenger: Delegatee;
|
|
513
|
+
}): void;
|
|
514
|
+
/**
|
|
515
|
+
* Register an action handler for an action delegated from another messenger.
|
|
516
|
+
*
|
|
517
|
+
* This will make the registered function available to call via the `call` method.
|
|
518
|
+
*
|
|
519
|
+
* Note: This is an internal method. Never access this property from another module. This must be
|
|
520
|
+
* exposed as a public property so that these methods can be called internally on other messenger
|
|
521
|
+
* instances.
|
|
522
|
+
*
|
|
523
|
+
* @deprecated Internal use only. Use the `delegate` method for delegation.
|
|
524
|
+
* @param actionType - The action type. This is a unique identifier for this action.
|
|
525
|
+
* @param handler - The action handler. This function gets called when the `call` method is
|
|
526
|
+
* invoked with the given action type.
|
|
527
|
+
* @throws Will throw when a handler has been registered for this action type already.
|
|
528
|
+
* @template ActionType - A type union of Action type strings.
|
|
529
|
+
*/
|
|
530
|
+
_internalRegisterDelegatedActionHandler<ActionType extends Action['type']>(actionType: ActionType, handler: ActionHandler<ActionConstraint, ActionType>): void;
|
|
531
|
+
/**
|
|
532
|
+
* Unregister an action handler for an action delegated from another messenger.
|
|
533
|
+
*
|
|
534
|
+
* This will prevent this action from being called.
|
|
535
|
+
*
|
|
536
|
+
* Note: This is an internal method. Never access this property from another module. This must be
|
|
537
|
+
* exposed as a public property so that these methods can be called internally on other messenger
|
|
538
|
+
* instances.
|
|
539
|
+
*
|
|
540
|
+
* @deprecated Internal use only. Use the `delegate` method for delegation.
|
|
541
|
+
* @param actionType - The action type. This is a unqiue identifier for this action.
|
|
542
|
+
* @template ActionType - A type union of Action type strings.
|
|
543
|
+
*/
|
|
544
|
+
_internalUnregisterDelegatedActionHandler<ActionType extends Action['type']>(actionType: ActionType): void;
|
|
545
|
+
/**
|
|
546
|
+
* Register a function for getting the initial payload for an event that has been delegated from
|
|
547
|
+
* another messenger.
|
|
548
|
+
*
|
|
549
|
+
* This is used for events that represent a state change, where the payload is the state.
|
|
550
|
+
* Registering a function for getting the payload allows event selectors to have a point of
|
|
551
|
+
* comparison the first time state changes.
|
|
552
|
+
*
|
|
553
|
+
* Note: This is an internal method. Never access this property from another module. This must be
|
|
554
|
+
* exposed as a public property so that these methods can be called internally on other messenger
|
|
555
|
+
* instances.
|
|
556
|
+
*
|
|
557
|
+
* @deprecated Internal use only. Use the `delegate` method for delegation.
|
|
558
|
+
* @param args - The arguments to this function
|
|
559
|
+
* @param args.eventType - The event type to register a payload for.
|
|
560
|
+
* @param args.getPayload - A function for retrieving the event payload.
|
|
561
|
+
*/
|
|
562
|
+
_internalRegisterDelegatedInitialEventPayload<EventType extends Event['type']>({ eventType, getPayload, }: {
|
|
563
|
+
eventType: EventType;
|
|
564
|
+
getPayload: () => ExtractEventPayload<Event, EventType>;
|
|
565
|
+
}): void;
|
|
566
|
+
/**
|
|
567
|
+
* Publish an event that was delegated from another messenger.
|
|
568
|
+
*
|
|
569
|
+
* Publishes the given payload to all subscribers of the given event type.
|
|
570
|
+
*
|
|
571
|
+
* Note that this method should never throw directly. Any errors from
|
|
572
|
+
* subscribers are captured and re-thrown in a timeout handler.
|
|
573
|
+
*
|
|
574
|
+
* Note: This is an internal method. Never access this property from another module. This must be
|
|
575
|
+
* exposed as a public property so that these methods can be called internally on other messenger
|
|
576
|
+
* instances.
|
|
577
|
+
*
|
|
578
|
+
* @deprecated Internal use only. Use the `delegate` method for delegation.
|
|
579
|
+
* @param eventType - The event type. This is a unique identifier for this event.
|
|
580
|
+
* @param payload - The event payload. The type of the parameters for each event handler must
|
|
581
|
+
* match the type of this payload.
|
|
582
|
+
* @template EventType - A type union of Event type strings.
|
|
583
|
+
*/
|
|
584
|
+
_internalPublishDelegated<EventType extends Event['type']>(eventType: EventType, ...payload: ExtractEventPayload<Event, EventType>): void;
|
|
585
|
+
}
|
|
586
|
+
export {};
|
|
587
|
+
//# sourceMappingURL=Messenger.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Messenger.d.mts","sourceRoot":"","sources":["../src/Messenger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,CACvB,MAAM,SAAS,gBAAgB,EAC/B,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IACzB,CACF,GAAG,IAAI,EAAE,uBAAuB,CAAC,MAAM,EAAE,UAAU,CAAC,KACjD,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE/C,MAAM,MAAM,uBAAuB,CACjC,MAAM,SAAS,gBAAgB,EAC/B,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IACzB,MAAM,SAAS;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,WAAW,KAAK,OAAO,CAAC;CAClD,GACG,WAAW,GACX,KAAK,CAAC;AAEV,MAAM,MAAM,qBAAqB,CAC/B,MAAM,SAAS,gBAAgB,EAC/B,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IACzB,MAAM,SAAS;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,kBAAkB,CAAC;CACzD,GACG,kBAAkB,GAClB,KAAK,CAAC;AAEV,MAAM,MAAM,mBAAmB,CAC7B,KAAK,SAAS,eAAe,EAC7B,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,IACvB,KAAK,SAAS;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,OAAO,CAAC;CACxB,GACG,OAAO,SAAS,OAAO,EAAE,GACvB,CAAC,GAAG,OAAO,EAAE,OAAO,KAAK,IA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;;;;;;;;;;;;;;;OAiBG;IACH,yBAAyB,CAAC,SAAS,SAAS,KAAK,CAAC,MAAM,CAAC,EACvD,SAAS,EAAE,SAAS,EACpB,GAAG,OAAO,EAAE,mBAAmB,CAAC,KAAK,EAAE,SAAS,CAAC,GAChD,IAAI;CAkBR"}
|
|
@@ -695,4 +695,4 @@ _Messenger_namespace = new WeakMap(), _Messenger_parent = new WeakMap(), _Messen
|
|
|
695
695
|
return (__classPrivateFieldGet(this, _Messenger_namespace, "f") === MOCK_ANY_NAMESPACE ||
|
|
696
696
|
name.startsWith(`${__classPrivateFieldGet(this, _Messenger_namespace, "f")}:`));
|
|
697
697
|
};
|
|
698
|
-
//# sourceMappingURL=Messenger.
|
|
698
|
+
//# sourceMappingURL=Messenger.mjs.map
|