@wireapp/core 31.1.0 → 31.1.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.
package/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { QualifiedUserClientMap } from '@wireapp/api-client/src/client';
|
|
2
|
+
declare type UserId = string;
|
|
3
|
+
declare type ClientId = string;
|
|
4
|
+
declare type Domain = string;
|
|
5
|
+
export declare type ClientIdStringType = `${UserId}:${ClientId}@${Domain}`;
|
|
6
|
+
export declare const constructFullyQualifiedClientId: (userId: UserId, clientId: ClientId, domain: Domain) => ClientIdStringType;
|
|
7
|
+
export declare const mapQualifiedUserClientIdsToFullyQualifiedClientIds: (qualifiedUserMap: QualifiedUserClientMap) => Uint8Array[];
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2022 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.mapQualifiedUserClientIdsToFullyQualifiedClientIds = exports.constructFullyQualifiedClientId = void 0;
|
|
22
|
+
const constructFullyQualifiedClientId = (userId, clientId, domain) => `${userId}:${clientId}@${domain}`;
|
|
23
|
+
exports.constructFullyQualifiedClientId = constructFullyQualifiedClientId;
|
|
24
|
+
const mapQualifiedUserClientIdsToFullyQualifiedClientIds = (qualifiedUserMap) => {
|
|
25
|
+
const encoder = new TextEncoder();
|
|
26
|
+
return Object.entries(qualifiedUserMap).flatMap(([domain, users]) => {
|
|
27
|
+
const clients = Object.entries(users);
|
|
28
|
+
return clients.flatMap(([userId, clients]) => clients.map(client => encoder.encode((0, exports.constructFullyQualifiedClientId)(userId, client.id, domain))));
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
exports.mapQualifiedUserClientIdsToFullyQualifiedClientIds = mapQualifiedUserClientIdsToFullyQualifiedClientIds;
|
|
32
|
+
//# sourceMappingURL=mapQualifiedUserClientIdsToFullyQualifiedClientIds.js.map
|