@metamask-previews/core-backend 0.0.0-preview-bc80f5a1

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LICENSE +20 -0
  3. package/README.md +360 -0
  4. package/dist/AccountActivityService-method-action-types.cjs +7 -0
  5. package/dist/AccountActivityService-method-action-types.cjs.map +1 -0
  6. package/dist/AccountActivityService-method-action-types.d.cts +30 -0
  7. package/dist/AccountActivityService-method-action-types.d.cts.map +1 -0
  8. package/dist/AccountActivityService-method-action-types.d.mts +30 -0
  9. package/dist/AccountActivityService-method-action-types.d.mts.map +1 -0
  10. package/dist/AccountActivityService-method-action-types.mjs +6 -0
  11. package/dist/AccountActivityService-method-action-types.mjs.map +1 -0
  12. package/dist/AccountActivityService.cjs +380 -0
  13. package/dist/AccountActivityService.cjs.map +1 -0
  14. package/dist/AccountActivityService.d.cts +148 -0
  15. package/dist/AccountActivityService.d.cts.map +1 -0
  16. package/dist/AccountActivityService.d.mts +148 -0
  17. package/dist/AccountActivityService.d.mts.map +1 -0
  18. package/dist/AccountActivityService.mjs +376 -0
  19. package/dist/AccountActivityService.mjs.map +1 -0
  20. package/dist/BackendWebSocketService-method-action-types.cjs +7 -0
  21. package/dist/BackendWebSocketService-method-action-types.cjs.map +1 -0
  22. package/dist/BackendWebSocketService-method-action-types.d.cts +146 -0
  23. package/dist/BackendWebSocketService-method-action-types.d.cts.map +1 -0
  24. package/dist/BackendWebSocketService-method-action-types.d.mts +146 -0
  25. package/dist/BackendWebSocketService-method-action-types.d.mts.map +1 -0
  26. package/dist/BackendWebSocketService-method-action-types.mjs +6 -0
  27. package/dist/BackendWebSocketService-method-action-types.mjs.map +1 -0
  28. package/dist/BackendWebSocketService.cjs +841 -0
  29. package/dist/BackendWebSocketService.cjs.map +1 -0
  30. package/dist/BackendWebSocketService.d.cts +366 -0
  31. package/dist/BackendWebSocketService.d.cts.map +1 -0
  32. package/dist/BackendWebSocketService.d.mts +366 -0
  33. package/dist/BackendWebSocketService.d.mts.map +1 -0
  34. package/dist/BackendWebSocketService.mjs +836 -0
  35. package/dist/BackendWebSocketService.mjs.map +1 -0
  36. package/dist/index.cjs +14 -0
  37. package/dist/index.cjs.map +1 -0
  38. package/dist/index.d.cts +10 -0
  39. package/dist/index.d.cts.map +1 -0
  40. package/dist/index.d.mts +10 -0
  41. package/dist/index.d.mts.map +1 -0
  42. package/dist/index.mjs +7 -0
  43. package/dist/index.mjs.map +1 -0
  44. package/dist/logger.cjs +7 -0
  45. package/dist/logger.cjs.map +1 -0
  46. package/dist/logger.d.cts +5 -0
  47. package/dist/logger.d.cts.map +1 -0
  48. package/dist/logger.d.mts +5 -0
  49. package/dist/logger.d.mts.map +1 -0
  50. package/dist/logger.mjs +4 -0
  51. package/dist/logger.mjs.map +1 -0
  52. package/dist/types.cjs +3 -0
  53. package/dist/types.cjs.map +1 -0
  54. package/dist/types.d.cts +71 -0
  55. package/dist/types.d.cts.map +1 -0
  56. package/dist/types.d.mts +71 -0
  57. package/dist/types.d.mts.map +1 -0
  58. package/dist/types.mjs +2 -0
  59. package/dist/types.mjs.map +1 -0
  60. package/package.json +80 -0
@@ -0,0 +1,366 @@
1
+ import type { RestrictedMessenger } from "@metamask/base-controller";
2
+ import type { AuthenticationController } from "@metamask/profile-sync-controller";
3
+ import type { BackendWebSocketServiceMethodActions } from "./BackendWebSocketService-method-action-types.mjs";
4
+ declare const SERVICE_NAME: "BackendWebSocketService";
5
+ /**
6
+ * Gets human-readable close reason from RFC 6455 close code
7
+ *
8
+ * @param code - WebSocket close code
9
+ * @returns Human-readable close reason
10
+ */
11
+ export declare function getCloseReason(code: number): string;
12
+ /**
13
+ * WebSocket connection states
14
+ */
15
+ export declare enum WebSocketState {
16
+ CONNECTING = "connecting",
17
+ CONNECTED = "connected",
18
+ DISCONNECTING = "disconnecting",
19
+ DISCONNECTED = "disconnected",
20
+ ERROR = "error"
21
+ }
22
+ /**
23
+ * WebSocket event types
24
+ */
25
+ export declare enum WebSocketEventType {
26
+ CONNECTED = "connected",
27
+ DISCONNECTED = "disconnected",
28
+ MESSAGE = "message",
29
+ ERROR = "error",
30
+ RECONNECTING = "reconnecting",
31
+ RECONNECTED = "reconnected"
32
+ }
33
+ /**
34
+ * Configuration options for the WebSocket service
35
+ */
36
+ export type BackendWebSocketServiceOptions = {
37
+ /** The WebSocket URL to connect to */
38
+ url: string;
39
+ /** The messenger for inter-service communication */
40
+ messenger: BackendWebSocketServiceMessenger;
41
+ /** Connection timeout in milliseconds (default: 10000) */
42
+ timeout?: number;
43
+ /** Initial reconnection delay in milliseconds (default: 500) */
44
+ reconnectDelay?: number;
45
+ /** Maximum reconnection delay in milliseconds (default: 5000) */
46
+ maxReconnectDelay?: number;
47
+ /** Request timeout in milliseconds (default: 30000) */
48
+ requestTimeout?: number;
49
+ /** Optional callback to determine if connection should be enabled (default: always enabled) */
50
+ isEnabled?: () => boolean;
51
+ };
52
+ /**
53
+ * Client Request message
54
+ * Used when client sends a request to the server
55
+ */
56
+ export type ClientRequestMessage = {
57
+ event: string;
58
+ data: {
59
+ requestId: string;
60
+ channels?: string[];
61
+ [key: string]: unknown;
62
+ };
63
+ };
64
+ /**
65
+ * Server Response message
66
+ * Used when server responds to a client request
67
+ */
68
+ export type ServerResponseMessage = {
69
+ event: string;
70
+ data: {
71
+ requestId: string;
72
+ subscriptionId?: string;
73
+ succeeded?: string[];
74
+ failed?: string[];
75
+ [key: string]: unknown;
76
+ };
77
+ };
78
+ /**
79
+ * Server Notification message
80
+ * Used when server sends unsolicited data to client
81
+ * subscriptionId is optional for system-wide notifications
82
+ */
83
+ export type ServerNotificationMessage = {
84
+ event: string;
85
+ subscriptionId?: string;
86
+ channel: string;
87
+ data: Record<string, unknown>;
88
+ };
89
+ /**
90
+ * Union type for all WebSocket messages
91
+ */
92
+ export type WebSocketMessage = ClientRequestMessage | ServerResponseMessage | ServerNotificationMessage;
93
+ /**
94
+ * Channel-based callback configuration
95
+ */
96
+ export type ChannelCallback = {
97
+ /** Channel name to match (also serves as the unique identifier) */
98
+ channelName: string;
99
+ /** Callback function */
100
+ callback: (notification: ServerNotificationMessage) => void;
101
+ };
102
+ /**
103
+ * Unified WebSocket subscription object used for both internal storage and external API
104
+ */
105
+ export type WebSocketSubscription = {
106
+ /** The subscription ID from the server */
107
+ subscriptionId: string;
108
+ /** Channel names for this subscription */
109
+ channels: string[];
110
+ /** Callback function for handling notifications (optional for external use) */
111
+ callback?: (notification: ServerNotificationMessage) => void;
112
+ /** Function to unsubscribe and clean up */
113
+ unsubscribe: (requestId?: string) => Promise<void>;
114
+ };
115
+ /**
116
+ * WebSocket connection info
117
+ */
118
+ export type WebSocketConnectionInfo = {
119
+ state: WebSocketState;
120
+ url: string;
121
+ reconnectAttempts: number;
122
+ connectedAt?: number;
123
+ };
124
+ export type BackendWebSocketServiceActions = BackendWebSocketServiceMethodActions;
125
+ export type BackendWebSocketServiceAllowedActions = AuthenticationController.AuthenticationControllerGetBearerToken | BackendWebSocketServiceMethodActions;
126
+ export type BackendWebSocketServiceAllowedEvents = AuthenticationController.AuthenticationControllerStateChangeEvent | BackendWebSocketServiceConnectionStateChangedEvent;
127
+ export type BackendWebSocketServiceConnectionStateChangedEvent = {
128
+ type: 'BackendWebSocketService:connectionStateChanged';
129
+ payload: [WebSocketConnectionInfo];
130
+ };
131
+ export type BackendWebSocketServiceEvents = BackendWebSocketServiceConnectionStateChangedEvent;
132
+ export type BackendWebSocketServiceMessenger = RestrictedMessenger<typeof SERVICE_NAME, BackendWebSocketServiceActions | BackendWebSocketServiceAllowedActions, BackendWebSocketServiceEvents | BackendWebSocketServiceAllowedEvents, BackendWebSocketServiceAllowedActions['type'], BackendWebSocketServiceAllowedEvents['type']>;
133
+ /**
134
+ * WebSocket Service with automatic reconnection, session management and direct callback routing
135
+ *
136
+ * Real-Time Performance Optimizations:
137
+ * - Fast path message routing (zero allocations)
138
+ * - Production mode removes try-catch overhead
139
+ * - Optimized JSON parsing with fail-fast
140
+ * - Direct callback routing bypasses event emitters
141
+ * - Memory cleanup and resource management
142
+ *
143
+ * Mobile Integration:
144
+ * Mobile apps should handle lifecycle events (background/foreground) by:
145
+ * 1. Calling disconnect() when app goes to background
146
+ * 2. Calling connect() when app returns to foreground
147
+ * 3. Calling destroy() on app termination
148
+ */
149
+ export declare class BackendWebSocketService {
150
+ #private;
151
+ /**
152
+ * The name of the service.
153
+ */
154
+ readonly name: "BackendWebSocketService";
155
+ /**
156
+ * Creates a new WebSocket service instance
157
+ *
158
+ * @param options - Configuration options for the WebSocket service
159
+ */
160
+ constructor(options: BackendWebSocketServiceOptions);
161
+ /**
162
+ * Establishes WebSocket connection with smart reconnection behavior
163
+ *
164
+ * Simplified Priority System (using AuthenticationController):
165
+ * 1. App closed/backgrounded → Stop all attempts (save resources)
166
+ * 2. User not signed in (wallet locked OR not authenticated) → Keep retrying
167
+ * 3. User signed in (wallet unlocked + authenticated) → Connect successfully
168
+ *
169
+ * @returns Promise that resolves when connection is established
170
+ */
171
+ connect(): Promise<void>;
172
+ /**
173
+ * Closes WebSocket connection
174
+ *
175
+ * @returns Promise that resolves when disconnection is complete
176
+ */
177
+ disconnect(): Promise<void>;
178
+ /**
179
+ * Sends a message through the WebSocket (fire-and-forget, no response expected)
180
+ *
181
+ * This is a low-level method for sending messages without waiting for a response.
182
+ * Most consumers should use `sendRequest()` instead, which handles request-response
183
+ * correlation and provides proper error handling with timeouts.
184
+ *
185
+ * Use this method only when:
186
+ * - You don't need a response from the server
187
+ * - You're implementing custom message protocols
188
+ * - You need fine-grained control over message timing
189
+ *
190
+ * @param message - The message to send
191
+ * @throws Error if WebSocket is not connected or send fails
192
+ *
193
+ * @see sendRequest for request-response pattern with automatic correlation
194
+ */
195
+ sendMessage(message: ClientRequestMessage): void;
196
+ /**
197
+ * Sends a request and waits for a correlated response (recommended for most use cases)
198
+ *
199
+ * This is the recommended high-level method for request-response communication.
200
+ * It automatically handles:
201
+ * - Request ID generation and correlation
202
+ * - Response matching with timeout protection
203
+ * - Automatic reconnection on timeout
204
+ * - Proper cleanup of pending requests
205
+ *
206
+ * @param message - The request message (can include optional requestId for testing)
207
+ * @returns Promise that resolves with the response data
208
+ * @throws Error if WebSocket is not connected, request times out, or response indicates failure
209
+ *
210
+ * @see sendMessage for fire-and-forget messaging without response handling
211
+ */
212
+ sendRequest<T = ServerResponseMessage['data']>(message: Omit<ClientRequestMessage, 'data'> & {
213
+ data?: Omit<ClientRequestMessage['data'], 'requestId'> & {
214
+ requestId?: string;
215
+ };
216
+ }): Promise<T>;
217
+ /**
218
+ * Gets current connection information
219
+ *
220
+ * @returns Current connection status and details
221
+ */
222
+ getConnectionInfo(): WebSocketConnectionInfo;
223
+ /**
224
+ * Gets all subscription information for a specific channel
225
+ *
226
+ * @param channel - The channel name to look up
227
+ * @returns Array of subscription details for all subscriptions containing the channel
228
+ */
229
+ getSubscriptionsByChannel(channel: string): WebSocketSubscription[];
230
+ /**
231
+ * Checks if a channel has a subscription
232
+ *
233
+ * @param channel - The channel name to check
234
+ * @returns True if the channel has a subscription, false otherwise
235
+ */
236
+ channelHasSubscription(channel: string): boolean;
237
+ /**
238
+ * Finds all subscriptions that have channels starting with the specified prefix
239
+ *
240
+ * @param channelPrefix - The channel prefix to search for (e.g., "account-activity.v1")
241
+ * @returns Array of subscription info for matching subscriptions
242
+ */
243
+ findSubscriptionsByChannelPrefix(channelPrefix: string): WebSocketSubscription[];
244
+ /**
245
+ * Register a callback for specific channels (local callback only, no server subscription)
246
+ *
247
+ * **Key Difference from `subscribe()`:**
248
+ * - `addChannelCallback()`: Registers a local callback without creating a server-side subscription.
249
+ * The callback triggers on ANY message matching the channel name, regardless of subscriptionId.
250
+ * Useful for system-wide notifications or when you don't control the subscription lifecycle.
251
+ *
252
+ * - `subscribe()`: Creates a proper server-side subscription with a subscriptionId.
253
+ * The callback only triggers for messages with the matching subscriptionId.
254
+ * Includes proper lifecycle management (unsubscribe, automatic cleanup on disconnect).
255
+ *
256
+ * **When to use `addChannelCallback()`:**
257
+ * - Listening to system-wide notifications (e.g., 'system-notifications.v1')
258
+ * - Monitoring channels where subscriptions are managed elsewhere
259
+ * - Debug/logging scenarios where you want to observe all channel messages
260
+ *
261
+ * **When to use `subscribe()` instead:**
262
+ * - Creating new subscriptions that need server-side registration
263
+ * - When you need proper cleanup via unsubscribe
264
+ * - Most application use cases (recommended approach)
265
+ *
266
+ * @param options - Channel callback configuration
267
+ * @param options.channelName - Channel name to match exactly
268
+ * @param options.callback - Function to call when channel matches
269
+ *
270
+ * @example
271
+ * ```typescript
272
+ * // Listen to system notifications (no server subscription needed)
273
+ * webSocketService.addChannelCallback({
274
+ * channelName: 'system-notifications.v1',
275
+ * callback: (notification) => {
276
+ * console.log('System notification:', notification.data);
277
+ * }
278
+ * });
279
+ *
280
+ * // For account-specific subscriptions, use subscribe() instead:
281
+ * // const sub = await webSocketService.subscribe({
282
+ * // channels: ['account-activity.v1.eip155:0:0x1234...'],
283
+ * // callback: (notification) => { ... }
284
+ * // });
285
+ * ```
286
+ *
287
+ * @see subscribe for creating proper server-side subscriptions with lifecycle management
288
+ */
289
+ addChannelCallback(options: {
290
+ channelName: string;
291
+ callback: (notification: ServerNotificationMessage) => void;
292
+ }): void;
293
+ /**
294
+ * Remove a channel callback
295
+ *
296
+ * @param channelName - The channel name returned from addChannelCallback
297
+ * @returns True if callback was found and removed, false otherwise
298
+ */
299
+ removeChannelCallback(channelName: string): boolean;
300
+ /**
301
+ * Get all registered channel callbacks (for debugging)
302
+ *
303
+ * @returns Array of all registered channel callbacks
304
+ */
305
+ getChannelCallbacks(): ChannelCallback[];
306
+ /**
307
+ * Destroy the service and clean up resources
308
+ * Called when service is being destroyed or app is terminating
309
+ */
310
+ destroy(): void;
311
+ /**
312
+ * Create and manage a subscription with server-side registration (recommended for most use cases)
313
+ *
314
+ * This is the recommended subscription API for high-level services. It creates a proper
315
+ * server-side subscription and routes notifications based on subscriptionId.
316
+ *
317
+ * **Key Features:**
318
+ * - Creates server-side subscription with unique subscriptionId
319
+ * - Callback triggered only for messages with matching subscriptionId
320
+ * - Automatic lifecycle management (cleanup on disconnect)
321
+ * - Includes unsubscribe method for proper cleanup
322
+ * - Request-response pattern with error handling
323
+ *
324
+ * **When to use `subscribe()`:**
325
+ * - Creating new subscriptions (account activity, price updates, etc.)
326
+ * - When you need proper cleanup/unsubscribe functionality
327
+ * - Most application use cases
328
+ *
329
+ * **When to use `addChannelCallback()` instead:**
330
+ * - System-wide notifications without server-side subscription
331
+ * - Observing channels managed elsewhere
332
+ * - Debug/logging scenarios
333
+ *
334
+ * @param options - Subscription configuration
335
+ * @param options.channels - Array of channel names to subscribe to
336
+ * @param options.callback - Callback function for handling notifications
337
+ * @param options.requestId - Optional request ID for testing (will generate UUID if not provided)
338
+ * @returns Subscription object with unsubscribe method
339
+ *
340
+ * @example
341
+ * ```typescript
342
+ * // AccountActivityService usage
343
+ * const subscription = await webSocketService.subscribe({
344
+ * channels: ['account-activity.v1.eip155:0:0x1234...'],
345
+ * callback: (notification) => {
346
+ * this.handleAccountActivity(notification.data);
347
+ * }
348
+ * });
349
+ *
350
+ * // Later, clean up
351
+ * await subscription.unsubscribe();
352
+ * ```
353
+ *
354
+ * @see addChannelCallback for local callbacks without server-side subscription
355
+ */
356
+ subscribe(options: {
357
+ /** Channel names to subscribe to */
358
+ channels: string[];
359
+ /** Handler for incoming notifications */
360
+ callback: (notification: ServerNotificationMessage) => void;
361
+ /** Optional request ID for testing (will generate UUID if not provided) */
362
+ requestId?: string;
363
+ }): Promise<WebSocketSubscription>;
364
+ }
365
+ export {};
366
+ //# sourceMappingURL=BackendWebSocketService.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BackendWebSocketService.d.mts","sourceRoot":"","sources":["../src/BackendWebSocketService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,kCAAkC;AACrE,OAAO,KAAK,EAAE,wBAAwB,EAAE,0CAA0C;AAI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