@wireapp/core 42.19.1 → 42.19.2
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/lib/Account.d.ts +5 -3
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +12 -6
- package/lib/conversation/ConversationService/ConversationService.d.ts +3 -2
- package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +3 -2
- package/lib/conversation/ConversationService/ConversationService.test.js +2 -1
- package/lib/conversation/SubconversationService/SubconversationService.d.ts +14 -3
- package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
- package/lib/conversation/SubconversationService/SubconversationService.js +33 -19
- package/lib/conversation/SubconversationService/SubconversationService.test.js +37 -53
- package/lib/conversation/SubconversationService/subconversationUtil.d.ts +4 -0
- package/lib/conversation/SubconversationService/subconversationUtil.d.ts.map +1 -0
- package/lib/conversation/SubconversationService/subconversationUtil.js +25 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts +4 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +2 -2
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.js +8 -8
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +2 -11
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +8 -24
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +5 -4
- package/lib/messagingProtocols/mls/types.d.ts +2 -3
- package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
- package/lib/storage/CoreDB.d.ts +10 -0
- package/lib/storage/CoreDB.d.ts.map +1 -1
- package/lib/storage/CoreDB.js +3 -1
- package/package.json +3 -3
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts +0 -13
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.js +0 -67
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.d.ts +0 -2
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.js +0 -72
package/lib/storage/CoreDB.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SUBCONVERSATION_ID } from '@wireapp/api-client/lib/conversation';
|
|
2
|
+
import { QualifiedId } from '@wireapp/api-client/lib/user';
|
|
1
3
|
import { DBSchema, IDBPDatabase } from 'idb';
|
|
2
4
|
interface CoreDBSchema extends DBSchema {
|
|
3
5
|
prekeys: {
|
|
@@ -28,6 +30,14 @@ interface CoreDBSchema extends DBSchema {
|
|
|
28
30
|
domain: string;
|
|
29
31
|
};
|
|
30
32
|
};
|
|
33
|
+
subconversations: {
|
|
34
|
+
key: string;
|
|
35
|
+
value: {
|
|
36
|
+
parentConversationId: QualifiedId;
|
|
37
|
+
subconversationId: SUBCONVERSATION_ID;
|
|
38
|
+
groupId: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
31
41
|
}
|
|
32
42
|
export type CoreDatabase = IDBPDatabase<CoreDBSchema>;
|
|
33
43
|
export declare function openDB(dbName: string): Promise<CoreDatabase>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreDB.d.ts","sourceRoot":"","sources":["../../src/storage/CoreDB.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,QAAQ,EAA2B,YAAY,EAAsB,MAAM,KAAK,CAAC;AAGzF,UAAU,YAAa,SAAQ,QAAQ;IACrC,OA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AAK,EAAE;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAC,CAAC;KAC9C,CAAC;IACF,cAAc,EAAE;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAC,CAAC;KAC1C,CAAC;IACF,qBAAqB,EAAE;QACrB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAC,CAAC;KACrC,CAAC;IACF,gBAAgB,EAAE;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,oBAAoB,EAAE,WAAW,CAAC;YAAC,iBAAiB,EAAE,kBAAkB,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAC,CAAC;KACpG,CAAC;CACH;AAED,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;AAEtD,wBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAmBlE;AAED,wBAAsB,QAAQ,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9D"}
|
package/lib/storage/CoreDB.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.deleteDB = exports.openDB = void 0;
|
|
22
22
|
const idb_1 = require("idb");
|
|
23
|
-
const VERSION =
|
|
23
|
+
const VERSION = 5;
|
|
24
24
|
async function openDB(dbName) {
|
|
25
25
|
const db = await (0, idb_1.openDB)(dbName, VERSION, {
|
|
26
26
|
upgrade: (db, oldVersion) => {
|
|
@@ -34,6 +34,8 @@ async function openDB(dbName) {
|
|
|
34
34
|
db.createObjectStore('recurringTasks');
|
|
35
35
|
case 3:
|
|
36
36
|
db.createObjectStore('conversationBlacklist');
|
|
37
|
+
case 4:
|
|
38
|
+
db.createObjectStore('subconversations');
|
|
37
39
|
}
|
|
38
40
|
},
|
|
39
41
|
});
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@wireapp/api-client": "^26.5.
|
|
14
|
+
"@wireapp/api-client": "^26.5.1",
|
|
15
15
|
"@wireapp/commons": "^5.2.2",
|
|
16
16
|
"@wireapp/core-crypto": "1.0.0-rc.16",
|
|
17
17
|
"@wireapp/cryptobox": "12.8.0",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"test:coverage": "jest --coverage",
|
|
62
62
|
"watch": "tsc --watch"
|
|
63
63
|
},
|
|
64
|
-
"version": "42.19.
|
|
65
|
-
"gitHead": "
|
|
64
|
+
"version": "42.19.2",
|
|
65
|
+
"gitHead": "96506c0e52f08f30c956c8b6a067d1e9e3e1abd2"
|
|
66
66
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SUBCONVERSATION_ID } from '@wireapp/api-client/lib/conversation';
|
|
2
|
-
import { QualifiedId } from '@wireapp/api-client/lib/user';
|
|
3
|
-
export declare const subconversationGroupIdStore: {
|
|
4
|
-
storeGroupId: (parentConversationId: QualifiedId, subconversationId: SUBCONVERSATION_ID, subconversationGroupId: string) => void;
|
|
5
|
-
getGroupId: (parentConversationId: QualifiedId, subconversationId: SUBCONVERSATION_ID) => string | undefined;
|
|
6
|
-
removeGroupId: (parentConversationId: QualifiedId, subconversationId: SUBCONVERSATION_ID) => void;
|
|
7
|
-
getAllGroupIdsBySubconversationId: (subconversationIdQuery: SUBCONVERSATION_ID) => {
|
|
8
|
-
subconversationGroupId: string;
|
|
9
|
-
parentConversationId: QualifiedId;
|
|
10
|
-
subconversationId: SUBCONVERSATION_ID;
|
|
11
|
-
}[];
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=subconversationGroupIdStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subconversationGroupIdStore.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAgEzD,eAAO,MAAM,2BAA2B;yCA3BhB,WAAW,qBACd,kBAAkB,0BACb,MAAM;uCAMU,WAAW,qBAAqB,kBAAkB;0CAc/C,WAAW,qBAAqB,kBAAkB;gEAT5B,kBAAkB;;8BArC3D,WAAW;2BAAqB,kBAAkB;;CAwD3E,CAAC"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2023 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.subconversationGroupIdStore = void 0;
|
|
22
|
-
const storageKey = 'subconversationGroupIdStore';
|
|
23
|
-
const generateSubconversationStoreKey = (parentConversationId, subconversationId) => {
|
|
24
|
-
return `${parentConversationId.id}@${parentConversationId.domain}:${subconversationId}`;
|
|
25
|
-
};
|
|
26
|
-
const parseSubconversationStoreKey = (subconversationStoreKey) => {
|
|
27
|
-
const [parentConversationId, subconversationId] = subconversationStoreKey.split(':');
|
|
28
|
-
const [id, domain] = parentConversationId.split('@');
|
|
29
|
-
return { parentConversationId: { domain, id }, subconversationId };
|
|
30
|
-
};
|
|
31
|
-
const getCurrentMap = () => {
|
|
32
|
-
const storedEntry = localStorage.getItem(storageKey);
|
|
33
|
-
return storedEntry ? new Map(JSON.parse(storedEntry)) : new Map();
|
|
34
|
-
};
|
|
35
|
-
const addItemToMap = (subconversationId, subgroupId) => {
|
|
36
|
-
const currentMap = getCurrentMap();
|
|
37
|
-
currentMap.set(subconversationId, subgroupId);
|
|
38
|
-
localStorage.setItem(storageKey, JSON.stringify(Array.from(currentMap.entries())));
|
|
39
|
-
};
|
|
40
|
-
const removeItemFromMap = (subconversationId) => {
|
|
41
|
-
const currentMap = getCurrentMap();
|
|
42
|
-
currentMap.delete(subconversationId);
|
|
43
|
-
localStorage.setItem(storageKey, JSON.stringify(Array.from(currentMap.entries())));
|
|
44
|
-
};
|
|
45
|
-
const storeGroupId = (parentConversationId, subconversationId, subconversationGroupId) => {
|
|
46
|
-
const subconversationStoreKey = generateSubconversationStoreKey(parentConversationId, subconversationId);
|
|
47
|
-
addItemToMap(subconversationStoreKey, subconversationGroupId);
|
|
48
|
-
};
|
|
49
|
-
const getGroupId = (parentConversationId, subconversationId) => {
|
|
50
|
-
const subconversationStoreKey = generateSubconversationStoreKey(parentConversationId, subconversationId);
|
|
51
|
-
return getCurrentMap().get(subconversationStoreKey);
|
|
52
|
-
};
|
|
53
|
-
const getAllGroupIdsBySubconversationId = (subconversationIdQuery) => {
|
|
54
|
-
return Array.from(getCurrentMap().entries())
|
|
55
|
-
.map(([subconversationId, subconversationGroupId]) => (Object.assign(Object.assign({}, parseSubconversationStoreKey(subconversationId)), { subconversationGroupId })))
|
|
56
|
-
.filter(({ subconversationId }) => subconversationId === subconversationIdQuery);
|
|
57
|
-
};
|
|
58
|
-
const removeGroupId = (parentConversationId, subconversationId) => {
|
|
59
|
-
const subconversationStoreKey = generateSubconversationStoreKey(parentConversationId, subconversationId);
|
|
60
|
-
return removeItemFromMap(subconversationStoreKey);
|
|
61
|
-
};
|
|
62
|
-
exports.subconversationGroupIdStore = {
|
|
63
|
-
storeGroupId,
|
|
64
|
-
getGroupId,
|
|
65
|
-
removeGroupId,
|
|
66
|
-
getAllGroupIdsBySubconversationId,
|
|
67
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subconversationGroupIdStore.test.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
const conversation_1 = require("@wireapp/api-client/lib/conversation");
|
|
22
|
-
const subconversationGroupIdStore_1 = require("./subconversationGroupIdStore");
|
|
23
|
-
describe('subconversationGroupIdMapper', () => {
|
|
24
|
-
it('returns empty groupId if conversation is not known', () => {
|
|
25
|
-
const groupId = subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId({ domain: 'example.com', id: '123' }, conversation_1.SUBCONVERSATION_ID.CONFERENCE);
|
|
26
|
-
expect(groupId).toBeUndefined();
|
|
27
|
-
});
|
|
28
|
-
it('returns the stored groupId', () => {
|
|
29
|
-
const conversationId = { domain: 'example.com', id: '123' };
|
|
30
|
-
const subconversation = conversation_1.SUBCONVERSATION_ID.CONFERENCE;
|
|
31
|
-
const groupId = 'groupID';
|
|
32
|
-
subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId, subconversation, groupId);
|
|
33
|
-
const result = subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId(conversationId, subconversation);
|
|
34
|
-
expect(result).toBe(groupId);
|
|
35
|
-
});
|
|
36
|
-
it('removes groupId from the store', () => {
|
|
37
|
-
const conversationId = { domain: 'example.com', id: '123' };
|
|
38
|
-
const subconversation = conversation_1.SUBCONVERSATION_ID.CONFERENCE;
|
|
39
|
-
const groupId = 'groupID';
|
|
40
|
-
subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId, subconversation, groupId);
|
|
41
|
-
expect(subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId(conversationId, subconversation)).toEqual(groupId);
|
|
42
|
-
subconversationGroupIdStore_1.subconversationGroupIdStore.removeGroupId(conversationId, subconversation);
|
|
43
|
-
expect(subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId(conversationId, subconversation)).toBeUndefined();
|
|
44
|
-
});
|
|
45
|
-
it('retrieves all entries from the store by subconversation id', () => {
|
|
46
|
-
const conversationId = { domain: 'example.com', id: '123' };
|
|
47
|
-
const subconversation = conversation_1.SUBCONVERSATION_ID.CONFERENCE;
|
|
48
|
-
const groupId = 'groupID';
|
|
49
|
-
const conversationId2 = { domain: 'example2.com', id: '1234' };
|
|
50
|
-
const subconversation2 = conversation_1.SUBCONVERSATION_ID.CONFERENCE;
|
|
51
|
-
const groupId2 = 'groupID2';
|
|
52
|
-
const conversationId3 = { domain: 'example3.com', id: '12345' };
|
|
53
|
-
const subconversation3 = 'none';
|
|
54
|
-
const groupId3 = 'groupID3';
|
|
55
|
-
subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId, subconversation, groupId);
|
|
56
|
-
subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId2, subconversation2, groupId2);
|
|
57
|
-
subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId3, subconversation3, groupId3);
|
|
58
|
-
const result = subconversationGroupIdStore_1.subconversationGroupIdStore.getAllGroupIdsBySubconversationId(conversation_1.SUBCONVERSATION_ID.CONFERENCE);
|
|
59
|
-
expect(result).toEqual([
|
|
60
|
-
{
|
|
61
|
-
parentConversationId: conversationId,
|
|
62
|
-
subconversationId: subconversation,
|
|
63
|
-
subconversationGroupId: groupId,
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
parentConversationId: conversationId2,
|
|
67
|
-
subconversationId: subconversation2,
|
|
68
|
-
subconversationGroupId: groupId2,
|
|
69
|
-
},
|
|
70
|
-
]);
|
|
71
|
-
});
|
|
72
|
-
});
|