@xmtp/browser-sdk 5.3.0 → 6.0.1

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 (53) hide show
  1. package/dist/index.d.ts +541 -671
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/workers/client.js +1 -1
  5. package/dist/workers/client.js.map +1 -1
  6. package/dist/workers/opfs.js +2 -0
  7. package/dist/workers/opfs.js.map +1 -0
  8. package/package.json +12 -16
  9. package/src/Client.ts +92 -219
  10. package/src/CodecRegistry.ts +27 -0
  11. package/src/Conversation.ts +275 -104
  12. package/src/Conversations.ts +188 -99
  13. package/src/DebugInformation.ts +10 -27
  14. package/src/DecodedMessage.ts +155 -58
  15. package/src/Dm.ts +25 -9
  16. package/src/Group.ts +30 -29
  17. package/src/Opfs.ts +63 -0
  18. package/src/Preferences.ts +68 -52
  19. package/src/WorkerClient.ts +5 -5
  20. package/src/WorkerConversation.ts +98 -45
  21. package/src/WorkerConversations.ts +35 -74
  22. package/src/WorkerDebugInformation.ts +1 -12
  23. package/src/WorkerPreferences.ts +6 -14
  24. package/src/index.ts +54 -24
  25. package/src/types/actions/client.ts +6 -17
  26. package/src/types/actions/conversation.ts +160 -31
  27. package/src/types/actions/conversations.ts +21 -24
  28. package/src/types/actions/debugInformation.ts +3 -11
  29. package/src/types/actions/dm.ts +1 -1
  30. package/src/types/actions/opfs.ts +66 -0
  31. package/src/types/actions/preferences.ts +6 -13
  32. package/src/types/actions/streams.ts +8 -8
  33. package/src/types/actions.ts +11 -9
  34. package/src/types/options.ts +46 -6
  35. package/src/{ClientWorkerClass.ts → utils/WorkerBridge.ts} +35 -45
  36. package/src/utils/contentTypes.ts +77 -0
  37. package/src/utils/conversions.ts +17 -590
  38. package/src/utils/createClient.ts +16 -11
  39. package/src/utils/errors.ts +13 -19
  40. package/src/utils/inboxId.ts +46 -0
  41. package/src/utils/inboxState.ts +23 -0
  42. package/src/utils/installations.ts +95 -0
  43. package/src/utils/metadata.ts +15 -0
  44. package/src/utils/signer.ts +4 -4
  45. package/src/utils/uuid.ts +8 -0
  46. package/src/workers/client.ts +176 -135
  47. package/src/workers/opfs.ts +127 -0
  48. package/dist/workers/utils.js +0 -2
  49. package/dist/workers/utils.js.map +0 -1
  50. package/src/Utils.ts +0 -143
  51. package/src/UtilsWorkerClass.ts +0 -121
  52. package/src/types/actions/utils.ts +0 -69
  53. package/src/workers/utils.ts +0 -155
@@ -3,9 +3,8 @@ import {
3
3
  type Consent,
4
4
  type ConsentEntityType,
5
5
  type Conversations,
6
- type UserPreference,
6
+ type UserPreferenceUpdate,
7
7
  } from "@xmtp/wasm-bindings";
8
- import { fromSafeConsent, type SafeConsent } from "@/utils/conversions";
9
8
  import type { StreamCallback } from "@/utils/streams";
10
9
 
11
10
  export class WorkerPreferences {
@@ -25,22 +24,15 @@ export class WorkerPreferences {
25
24
  return this.#client.inboxState(refreshFromNetwork);
26
25
  }
27
26
 
28
- async inboxStateFromInboxIds(
29
- inboxIds: string[],
30
- refreshFromNetwork?: boolean,
31
- ) {
27
+ async getInboxStates(inboxIds: string[], refreshFromNetwork?: boolean) {
32
28
  return this.#client.inboxStateFromInboxIds(
33
29
  inboxIds,
34
30
  refreshFromNetwork ?? false,
35
31
  );
36
32
  }
37
33
 
38
- async getLatestInboxState(inboxId: string) {
39
- return this.#client.getLatestInboxState(inboxId);
40
- }
41
-
42
- async setConsentStates(records: SafeConsent[]) {
43
- return this.#client.setConsentStates(records.map(fromSafeConsent));
34
+ async setConsentStates(records: Consent[]) {
35
+ return this.#client.setConsentStates(records);
44
36
  }
45
37
 
46
38
  async getConsentState(entityType: ConsentEntityType, entity: string) {
@@ -65,10 +57,10 @@ export class WorkerPreferences {
65
57
  }
66
58
 
67
59
  streamPreferences(
68
- callback: StreamCallback<UserPreference[]>,
60
+ callback: StreamCallback<UserPreferenceUpdate[]>,
69
61
  onFail: () => void,
70
62
  ) {
71
- const on_user_preference_update = (preferences: UserPreference[]) => {
63
+ const on_user_preference_update = (preferences: UserPreferenceUpdate[]) => {
72
64
  callback(null, preferences);
73
65
  };
74
66
  const on_error = (error: Error | null) => {
package/src/index.ts CHANGED
@@ -1,57 +1,87 @@
1
1
  export { Client } from "./Client";
2
- export type { ExtractCodecContentTypes } from "./Client";
2
+ export { Opfs } from "./Opfs";
3
3
  export { Conversations } from "./Conversations";
4
4
  export { Conversation } from "./Conversation";
5
5
  export { Dm } from "./Dm";
6
6
  export { Group } from "./Group";
7
- export type { MessageDeliveryStatus, MessageKind } from "./DecodedMessage";
8
7
  export { DecodedMessage } from "./DecodedMessage";
9
- export { Utils } from "./Utils";
8
+ export { generateInboxId, getInboxIdForIdentifier } from "./utils/inboxId";
9
+ export { metadataFieldName } from "./utils/metadata";
10
10
  export { ApiUrls, HistorySyncUrls } from "./constants";
11
11
  export type * from "./types/options";
12
12
  export * from "./utils/conversions";
13
+ export * from "./utils/contentTypes";
13
14
  export type { AsyncStreamProxy } from "./AsyncStream";
14
15
  export type {
15
- GroupSyncSummary,
16
- Identifier,
17
- IdentifierKind,
18
- UserPreference,
19
- } from "@xmtp/wasm-bindings";
20
- export {
16
+ Action,
17
+ Actions,
18
+ ApiStats,
19
+ Attachment,
21
20
  Consent,
22
- ConsentEntityType,
23
- ConsentState,
24
- ContentType,
25
- ContentTypeId,
21
+ ConversationDebugInfo,
26
22
  ConversationListItem,
27
- ConversationType,
28
- CreateDMOptions,
23
+ CreateDmOptions,
29
24
  CreateGroupOptions,
30
- DeliveryStatus,
31
- EncodedContent,
25
+ Cursor,
26
+ EncryptedAttachment,
32
27
  GroupMember,
33
- GroupMembershipState,
34
- GroupMessageKind,
35
28
  GroupMetadata,
36
29
  GroupPermissions,
37
- GroupPermissionsOptions,
30
+ GroupSyncSummary,
31
+ GroupUpdated,
38
32
  HmacKey,
33
+ Identifier,
34
+ IdentityStats,
35
+ Inbox,
39
36
  InboxState,
40
37
  Installation,
38
+ Intent,
39
+ KeyPackageStatus,
40
+ LeaveRequest,
41
+ Lifetime,
41
42
  ListConversationsOptions,
42
43
  ListMessagesOptions,
43
44
  LogOptions,
44
45
  Message,
45
46
  MessageDisappearingSettings,
47
+ MetadataFieldChange,
48
+ MultiRemoteAttachment,
49
+ PermissionPolicySet,
50
+ Reaction,
51
+ ReadReceipt,
52
+ RemoteAttachment,
53
+ RemoteAttachmentInfo,
54
+ Reply,
55
+ SendMessageOpts,
56
+ SignatureRequestHandle,
57
+ TransactionMetadata,
58
+ TransactionReference,
59
+ UserPreferenceUpdate,
60
+ WalletCall,
61
+ WalletSendCalls,
62
+ } from "@xmtp/wasm-bindings";
63
+ export {
64
+ ActionStyle,
65
+ ConsentEntityType,
66
+ ConsentState,
67
+ ContentType,
68
+ ConversationType,
69
+ DeliveryStatus,
70
+ GroupMembershipState,
71
+ GroupMessageKind,
72
+ GroupPermissionsOptions,
73
+ IdentifierKind,
74
+ ListConversationsOrderBy,
75
+ LogLevel,
76
+ MessageSortBy,
46
77
  MetadataField,
47
78
  PermissionLevel,
48
79
  PermissionPolicy,
49
- PermissionPolicySet,
50
80
  PermissionUpdateType,
51
- SignatureRequestHandle,
81
+ ReactionAction,
82
+ ReactionSchema,
52
83
  SortDirection,
53
84
  } from "@xmtp/wasm-bindings";
54
- export type { Signer, SafeSigner, EOASigner, SCWSigner } from "./utils/signer";
55
- export { toSafeSigner } from "./utils/signer";
85
+ export * from "./utils/signer";
56
86
  export * from "./utils/errors";
57
87
  export type * from "./utils/streams";
@@ -1,6 +1,5 @@
1
- import type { Identifier } from "@xmtp/wasm-bindings";
1
+ import type { Identifier, KeyPackageStatus } from "@xmtp/wasm-bindings";
2
2
  import type { ClientOptions } from "@/types/options";
3
- import type { SafeKeyPackageStatus } from "@/utils/conversions";
4
3
  import type { SafeSigner } from "@/utils/signer";
5
4
 
6
5
  export type ClientAction =
@@ -8,9 +7,11 @@ export type ClientAction =
8
7
  action: "client.init";
9
8
  id: string;
10
9
  result: {
10
+ appVersion: string;
11
11
  inboxId: string;
12
12
  installationId: string;
13
13
  installationIdBytes: Uint8Array;
14
+ libxmtpVersion: string;
14
15
  };
15
16
  data: {
16
17
  identifier: Identifier;
@@ -169,7 +170,7 @@ export type ClientAction =
169
170
  };
170
171
  }
171
172
  | {
172
- action: "client.findInboxIdByIdentifier";
173
+ action: "client.getInboxIdByIdentifier";
173
174
  id: string;
174
175
  result: string | undefined;
175
176
  data: {
@@ -204,22 +205,10 @@ export type ClientAction =
204
205
  };
205
206
  }
206
207
  | {
207
- action: "client.getKeyPackageStatusesForInstallationIds";
208
+ action: "client.fetchKeyPackageStatuses";
208
209
  id: string;
209
- result: Map<string, SafeKeyPackageStatus>;
210
+ result: Map<string, KeyPackageStatus>;
210
211
  data: {
211
212
  installationIds: string[];
212
213
  };
213
- }
214
- | {
215
- action: "client.libxmtpVersion";
216
- id: string;
217
- result: string;
218
- data: undefined;
219
- }
220
- | {
221
- action: "client.appVersion";
222
- id: string;
223
- result: string;
224
- data: undefined;
225
214
  };
@@ -1,14 +1,26 @@
1
- import type { ConsentState } from "@xmtp/wasm-bindings";
2
1
  import type {
2
+ Actions,
3
+ Attachment,
4
+ ConsentState,
5
+ ConversationDebugInfo,
6
+ DecodedMessage,
7
+ EncodedContent,
8
+ GroupMember,
9
+ Intent,
10
+ ListMessagesOptions,
11
+ MessageDisappearingSettings,
12
+ MultiRemoteAttachment,
13
+ Reaction,
14
+ RemoteAttachment,
15
+ Reply,
16
+ SendMessageOpts,
17
+ TransactionReference,
18
+ WalletSendCalls,
19
+ } from "@xmtp/wasm-bindings";
20
+ import type {
21
+ HmacKeys,
22
+ LastReadTimes,
3
23
  SafeConversation,
4
- SafeConversationDebugInfo,
5
- SafeEncodedContent,
6
- SafeGroupMember,
7
- SafeHmacKey,
8
- SafeListMessagesOptions,
9
- SafeMessage,
10
- SafeMessageDisappearingSettings,
11
- SafeSendMessageOpts,
12
24
  } from "@/utils/conversions";
13
25
 
14
26
  export type ConversationAction =
@@ -26,18 +38,8 @@ export type ConversationAction =
26
38
  result: string;
27
39
  data: {
28
40
  id: string;
29
- content: SafeEncodedContent;
30
- sendOptions: SafeSendMessageOpts;
31
- };
32
- }
33
- | {
34
- action: "conversation.sendOptimistic";
35
- id: string;
36
- result: string;
37
- data: {
38
- id: string;
39
- content: SafeEncodedContent;
40
- sendOptions: SafeSendMessageOpts;
41
+ content: EncodedContent;
42
+ options?: SendMessageOpts;
41
43
  };
42
44
  }
43
45
  | {
@@ -51,10 +53,10 @@ export type ConversationAction =
51
53
  | {
52
54
  action: "conversation.messages";
53
55
  id: string;
54
- result: SafeMessage[];
56
+ result: DecodedMessage[];
55
57
  data: {
56
58
  id: string;
57
- options?: SafeListMessagesOptions;
59
+ options?: ListMessagesOptions;
58
60
  };
59
61
  }
60
62
  | {
@@ -63,13 +65,13 @@ export type ConversationAction =
63
65
  result: bigint;
64
66
  data: {
65
67
  id: string;
66
- options?: Omit<SafeListMessagesOptions, "limit" | "direction">;
68
+ options?: Omit<ListMessagesOptions, "limit" | "direction">;
67
69
  };
68
70
  }
69
71
  | {
70
72
  action: "conversation.members";
71
73
  id: string;
72
- result: SafeGroupMember[];
74
+ result: GroupMember[];
73
75
  data: {
74
76
  id: string;
75
77
  };
@@ -77,7 +79,7 @@ export type ConversationAction =
77
79
  | {
78
80
  action: "conversation.messageDisappearingSettings";
79
81
  id: string;
80
- result: SafeMessageDisappearingSettings | undefined;
82
+ result: MessageDisappearingSettings | undefined;
81
83
  data: {
82
84
  id: string;
83
85
  };
@@ -86,7 +88,7 @@ export type ConversationAction =
86
88
  action: "conversation.updateMessageDisappearingSettings";
87
89
  id: string;
88
90
  result: undefined;
89
- data: SafeMessageDisappearingSettings & {
91
+ data: MessageDisappearingSettings & {
90
92
  id: string;
91
93
  };
92
94
  }
@@ -124,9 +126,9 @@ export type ConversationAction =
124
126
  };
125
127
  }
126
128
  | {
127
- action: "conversation.getHmacKeys";
129
+ action: "conversation.hmacKeys";
128
130
  id: string;
129
- result: Map<string, SafeHmacKey[]>;
131
+ result: HmacKeys;
130
132
  data: {
131
133
  id: string;
132
134
  };
@@ -134,7 +136,7 @@ export type ConversationAction =
134
136
  | {
135
137
  action: "conversation.debugInfo";
136
138
  id: string;
137
- result: SafeConversationDebugInfo;
139
+ result: ConversationDebugInfo;
138
140
  data: {
139
141
  id: string;
140
142
  };
@@ -159,7 +161,7 @@ export type ConversationAction =
159
161
  | {
160
162
  action: "conversation.lastMessage";
161
163
  id: string;
162
- result: SafeMessage | undefined;
164
+ result: DecodedMessage | undefined;
163
165
  data: {
164
166
  id: string;
165
167
  };
@@ -171,4 +173,131 @@ export type ConversationAction =
171
173
  data: {
172
174
  id: string;
173
175
  };
176
+ }
177
+ | {
178
+ action: "conversation.lastReadTimes";
179
+ id: string;
180
+ result: LastReadTimes;
181
+ data: {
182
+ id: string;
183
+ };
184
+ }
185
+ | {
186
+ action: "conversation.sendText";
187
+ id: string;
188
+ result: string;
189
+ data: {
190
+ id: string;
191
+ text: string;
192
+ isOptimistic?: boolean;
193
+ };
194
+ }
195
+ | {
196
+ action: "conversation.sendMarkdown";
197
+ id: string;
198
+ result: string;
199
+ data: {
200
+ id: string;
201
+ markdown: string;
202
+ isOptimistic?: boolean;
203
+ };
204
+ }
205
+ | {
206
+ action: "conversation.sendReaction";
207
+ id: string;
208
+ result: string;
209
+ data: {
210
+ id: string;
211
+ reaction: Reaction;
212
+ isOptimistic?: boolean;
213
+ };
214
+ }
215
+ | {
216
+ action: "conversation.sendReadReceipt";
217
+ id: string;
218
+ result: string;
219
+ data: {
220
+ id: string;
221
+ isOptimistic?: boolean;
222
+ };
223
+ }
224
+ | {
225
+ action: "conversation.sendReply";
226
+ id: string;
227
+ result: string;
228
+ data: {
229
+ id: string;
230
+ reply: Reply;
231
+ isOptimistic?: boolean;
232
+ };
233
+ }
234
+ | {
235
+ action: "conversation.sendTransactionReference";
236
+ id: string;
237
+ result: string;
238
+ data: {
239
+ id: string;
240
+ transactionReference: TransactionReference;
241
+ isOptimistic?: boolean;
242
+ };
243
+ }
244
+ | {
245
+ action: "conversation.sendWalletSendCalls";
246
+ id: string;
247
+ result: string;
248
+ data: {
249
+ id: string;
250
+ walletSendCalls: WalletSendCalls;
251
+ isOptimistic?: boolean;
252
+ };
253
+ }
254
+ | {
255
+ action: "conversation.sendActions";
256
+ id: string;
257
+ result: string;
258
+ data: {
259
+ id: string;
260
+ actions: Actions;
261
+ isOptimistic?: boolean;
262
+ };
263
+ }
264
+ | {
265
+ action: "conversation.sendIntent";
266
+ id: string;
267
+ result: string;
268
+ data: {
269
+ id: string;
270
+ intent: Intent;
271
+ isOptimistic?: boolean;
272
+ };
273
+ }
274
+ | {
275
+ action: "conversation.sendAttachment";
276
+ id: string;
277
+ result: string;
278
+ data: {
279
+ id: string;
280
+ attachment: Attachment;
281
+ isOptimistic?: boolean;
282
+ };
283
+ }
284
+ | {
285
+ action: "conversation.sendMultiRemoteAttachment";
286
+ id: string;
287
+ result: string;
288
+ data: {
289
+ id: string;
290
+ multiRemoteAttachment: MultiRemoteAttachment;
291
+ isOptimistic?: boolean;
292
+ };
293
+ }
294
+ | {
295
+ action: "conversation.sendRemoteAttachment";
296
+ id: string;
297
+ result: string;
298
+ data: {
299
+ id: string;
300
+ remoteAttachment: RemoteAttachment;
301
+ isOptimistic?: boolean;
302
+ };
174
303
  };
@@ -1,16 +1,13 @@
1
1
  import type {
2
2
  ConsentState,
3
3
  ConversationType,
4
+ CreateDmOptions,
5
+ CreateGroupOptions,
6
+ DecodedMessage,
4
7
  Identifier,
8
+ ListConversationsOptions,
5
9
  } from "@xmtp/wasm-bindings";
6
- import type {
7
- SafeConversation,
8
- SafeCreateDmOptions,
9
- SafeCreateGroupOptions,
10
- SafeHmacKeys,
11
- SafeListConversationsOptions,
12
- SafeMessage,
13
- } from "@/utils/conversions";
10
+ import type { HmacKeys, SafeConversation } from "@/utils/conversions";
14
11
 
15
12
  export type ConversationsAction =
16
13
  | {
@@ -24,7 +21,7 @@ export type ConversationsAction =
24
21
  | {
25
22
  action: "conversations.getMessageById";
26
23
  id: string;
27
- result: SafeMessage | undefined;
24
+ result: DecodedMessage | undefined;
28
25
  data: {
29
26
  id: string;
30
27
  };
@@ -42,7 +39,7 @@ export type ConversationsAction =
42
39
  id: string;
43
40
  result: SafeConversation[];
44
41
  data: {
45
- options?: SafeListConversationsOptions;
42
+ options?: ListConversationsOptions;
46
43
  };
47
44
  }
48
45
  | {
@@ -50,7 +47,7 @@ export type ConversationsAction =
50
47
  id: string;
51
48
  result: SafeConversation[];
52
49
  data: {
53
- options?: Omit<SafeListConversationsOptions, "conversation_type">;
50
+ options?: Omit<ListConversationsOptions, "conversationType">;
54
51
  };
55
52
  }
56
53
  | {
@@ -58,51 +55,51 @@ export type ConversationsAction =
58
55
  id: string;
59
56
  result: SafeConversation[];
60
57
  data: {
61
- options?: Omit<SafeListConversationsOptions, "conversation_type">;
58
+ options?: Omit<ListConversationsOptions, "conversationType">;
62
59
  };
63
60
  }
64
61
  | {
65
- action: "conversations.newGroupOptimistic";
62
+ action: "conversations.createGroupOptimistic";
66
63
  id: string;
67
64
  result: SafeConversation;
68
65
  data: {
69
- options?: SafeCreateGroupOptions;
66
+ options?: CreateGroupOptions;
70
67
  };
71
68
  }
72
69
  | {
73
- action: "conversations.newGroupWithIdentifiers";
70
+ action: "conversations.createGroupWithIdentifiers";
74
71
  id: string;
75
72
  result: SafeConversation;
76
73
  data: {
77
74
  identifiers: Identifier[];
78
- options?: SafeCreateGroupOptions;
75
+ options?: CreateGroupOptions;
79
76
  };
80
77
  }
81
78
  | {
82
- action: "conversations.newGroup";
79
+ action: "conversations.createGroup";
83
80
  id: string;
84
81
  result: SafeConversation;
85
82
  data: {
86
83
  inboxIds: string[];
87
- options?: SafeCreateGroupOptions;
84
+ options?: CreateGroupOptions;
88
85
  };
89
86
  }
90
87
  | {
91
- action: "conversations.newDmWithIdentifier";
88
+ action: "conversations.createDmWithIdentifier";
92
89
  id: string;
93
90
  result: SafeConversation;
94
91
  data: {
95
92
  identifier: Identifier;
96
- options?: SafeCreateDmOptions;
93
+ options?: CreateDmOptions;
97
94
  };
98
95
  }
99
96
  | {
100
- action: "conversations.newDm";
97
+ action: "conversations.createDm";
101
98
  id: string;
102
99
  result: SafeConversation;
103
100
  data: {
104
101
  inboxId: string;
105
- options?: SafeCreateDmOptions;
102
+ options?: CreateDmOptions;
106
103
  };
107
104
  }
108
105
  | {
@@ -120,9 +117,9 @@ export type ConversationsAction =
120
117
  };
121
118
  }
122
119
  | {
123
- action: "conversations.getHmacKeys";
120
+ action: "conversations.hmacKeys";
124
121
  id: string;
125
- result: SafeHmacKeys;
122
+ result: HmacKeys;
126
123
  data: undefined;
127
124
  }
128
125
  | {
@@ -1,16 +1,16 @@
1
- import type { SafeApiStats, SafeIdentityStats } from "@/utils/conversions";
1
+ import type { ApiStats, IdentityStats } from "@xmtp/wasm-bindings";
2
2
 
3
3
  export type DebugInformationAction =
4
4
  | {
5
5
  action: "debugInformation.apiStatistics";
6
6
  id: string;
7
- result: SafeApiStats;
7
+ result: ApiStats;
8
8
  data: undefined;
9
9
  }
10
10
  | {
11
11
  action: "debugInformation.apiIdentityStatistics";
12
12
  id: string;
13
- result: SafeIdentityStats;
13
+ result: IdentityStats;
14
14
  data: undefined;
15
15
  }
16
16
  | {
@@ -24,12 +24,4 @@ export type DebugInformationAction =
24
24
  id: string;
25
25
  result: undefined;
26
26
  data: undefined;
27
- }
28
- | {
29
- action: "debugInformation.uploadDebugArchive";
30
- id: string;
31
- result: string;
32
- data: {
33
- serverUrl?: string;
34
- };
35
27
  };
@@ -10,7 +10,7 @@ export type DmAction =
10
10
  };
11
11
  }
12
12
  | {
13
- action: "dm.getDuplicateDms";
13
+ action: "dm.duplicateDms";
14
14
  id: string;
15
15
  result: SafeConversation[];
16
16
  data: {
@@ -0,0 +1,66 @@
1
+ export type OpfsAction =
2
+ | {
3
+ action: "opfs.init";
4
+ id: string;
5
+ result: undefined;
6
+ data: {
7
+ enableLogging?: boolean;
8
+ };
9
+ }
10
+ | {
11
+ action: "opfs.listFiles";
12
+ id: string;
13
+ result: string[];
14
+ data: undefined;
15
+ }
16
+ | {
17
+ action: "opfs.fileCount";
18
+ id: string;
19
+ result: number;
20
+ data: undefined;
21
+ }
22
+ | {
23
+ action: "opfs.poolCapacity";
24
+ id: string;
25
+ result: number;
26
+ data: undefined;
27
+ }
28
+ | {
29
+ action: "opfs.fileExists";
30
+ id: string;
31
+ result: boolean;
32
+ data: {
33
+ path: string;
34
+ };
35
+ }
36
+ | {
37
+ action: "opfs.deleteFile";
38
+ id: string;
39
+ result: boolean;
40
+ data: {
41
+ path: string;
42
+ };
43
+ }
44
+ | {
45
+ action: "opfs.exportDb";
46
+ id: string;
47
+ result: Uint8Array;
48
+ data: {
49
+ path: string;
50
+ };
51
+ }
52
+ | {
53
+ action: "opfs.importDb";
54
+ id: string;
55
+ result: undefined;
56
+ data: {
57
+ path: string;
58
+ data: Uint8Array;
59
+ };
60
+ }
61
+ | {
62
+ action: "opfs.clearAll";
63
+ id: string;
64
+ result: undefined;
65
+ data: undefined;
66
+ };