@xmtp/browser-sdk 0.0.10 → 0.0.12
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/dist/index.d.ts +46 -18
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/workers/client.js +1 -1
- package/dist/workers/client.js.map +1 -1
- package/package.json +2 -2
- package/src/Client.ts +33 -4
- package/src/Conversation.ts +23 -6
- package/src/WorkerClient.ts +12 -2
- package/src/WorkerConversation.ts +15 -0
- package/src/WorkerConversations.ts +9 -11
- package/src/index.ts +1 -0
- package/src/types/clientEvents.ts +31 -1
- package/src/workers/client.ts +55 -11
package/src/workers/client.ts
CHANGED
|
@@ -105,8 +105,19 @@ self.onmessage = async (event: MessageEvent<ClientEventsClientMessageData>) => {
|
|
|
105
105
|
});
|
|
106
106
|
break;
|
|
107
107
|
}
|
|
108
|
+
case "revokeAllOtherInstallationsSignatureText": {
|
|
109
|
+
const result = await client.revokeAllAOtherInstallationsSignatureText();
|
|
110
|
+
postMessage({
|
|
111
|
+
id,
|
|
112
|
+
action,
|
|
113
|
+
result,
|
|
114
|
+
});
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
108
117
|
case "revokeInstallationsSignatureText": {
|
|
109
|
-
const result = await client.revokeInstallationsSignatureText(
|
|
118
|
+
const result = await client.revokeInstallationsSignatureText(
|
|
119
|
+
data.installationIds,
|
|
120
|
+
);
|
|
110
121
|
postMessage({
|
|
111
122
|
id,
|
|
112
123
|
action,
|
|
@@ -255,7 +266,7 @@ self.onmessage = async (event: MessageEvent<ClientEventsClientMessageData>) => {
|
|
|
255
266
|
* Conversations actions
|
|
256
267
|
*/
|
|
257
268
|
case "getConversations": {
|
|
258
|
-
const conversations =
|
|
269
|
+
const conversations = client.conversations.list(data.options);
|
|
259
270
|
postMessage({
|
|
260
271
|
id,
|
|
261
272
|
action,
|
|
@@ -268,9 +279,7 @@ self.onmessage = async (event: MessageEvent<ClientEventsClientMessageData>) => {
|
|
|
268
279
|
break;
|
|
269
280
|
}
|
|
270
281
|
case "getGroups": {
|
|
271
|
-
const conversations =
|
|
272
|
-
data.options,
|
|
273
|
-
);
|
|
282
|
+
const conversations = client.conversations.listGroups(data.options);
|
|
274
283
|
postMessage({
|
|
275
284
|
id,
|
|
276
285
|
action,
|
|
@@ -283,7 +292,7 @@ self.onmessage = async (event: MessageEvent<ClientEventsClientMessageData>) => {
|
|
|
283
292
|
break;
|
|
284
293
|
}
|
|
285
294
|
case "getDms": {
|
|
286
|
-
const conversations =
|
|
295
|
+
const conversations = client.conversations.listDms(data.options);
|
|
287
296
|
postMessage({
|
|
288
297
|
id,
|
|
289
298
|
action,
|
|
@@ -296,11 +305,6 @@ self.onmessage = async (event: MessageEvent<ClientEventsClientMessageData>) => {
|
|
|
296
305
|
break;
|
|
297
306
|
}
|
|
298
307
|
case "newGroup": {
|
|
299
|
-
// console.log(
|
|
300
|
-
// "newGroup",
|
|
301
|
-
// fromSafeCreateGroupOptions(data.options!),
|
|
302
|
-
// data.options,
|
|
303
|
-
// );
|
|
304
308
|
const conversation = await client.conversations.newGroup(
|
|
305
309
|
data.accountAddresses,
|
|
306
310
|
data.options,
|
|
@@ -826,6 +830,46 @@ self.onmessage = async (event: MessageEvent<ClientEventsClientMessageData>) => {
|
|
|
826
830
|
}
|
|
827
831
|
break;
|
|
828
832
|
}
|
|
833
|
+
case "updateGroupPermissionPolicy": {
|
|
834
|
+
const group = client.conversations.getConversationById(data.id);
|
|
835
|
+
if (group) {
|
|
836
|
+
await group.updatePermission(
|
|
837
|
+
data.permissionType,
|
|
838
|
+
data.policy,
|
|
839
|
+
data.metadataField,
|
|
840
|
+
);
|
|
841
|
+
postMessage({
|
|
842
|
+
id,
|
|
843
|
+
action,
|
|
844
|
+
result: undefined,
|
|
845
|
+
});
|
|
846
|
+
} else {
|
|
847
|
+
postMessageError({
|
|
848
|
+
id,
|
|
849
|
+
action,
|
|
850
|
+
error: "Group not found",
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
break;
|
|
854
|
+
}
|
|
855
|
+
case "getGroupPermissions": {
|
|
856
|
+
const group = client.conversations.getConversationById(data.id);
|
|
857
|
+
if (group) {
|
|
858
|
+
const safeConversation = await toSafeConversation(group);
|
|
859
|
+
postMessage({
|
|
860
|
+
id,
|
|
861
|
+
action,
|
|
862
|
+
result: safeConversation.permissions,
|
|
863
|
+
});
|
|
864
|
+
} else {
|
|
865
|
+
postMessageError({
|
|
866
|
+
id,
|
|
867
|
+
action,
|
|
868
|
+
error: "Group not found",
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
break;
|
|
872
|
+
}
|
|
829
873
|
}
|
|
830
874
|
} catch (e) {
|
|
831
875
|
postMessageError({
|