@wireapp/core 25.2.1 → 26.0.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,49 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [26.0.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@25.3.1...@wireapp/core@26.0.0) (2022-05-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Allow sending targeted lastRead and Countly messages ([#4262](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4262)) ([69c7d98](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/69c7d98272dc9beea6e5d9a99d6392177f0be361))
12
+
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * To send `lastRead` and `countly` as protobuf message, you now need to provide a `MessageSendingOptions` object as last parameter.
17
+
18
+ ```js
19
+ core.service.conversation.sendLastRead(conversation, timestamp, true);
20
+
21
+ // Becomes
22
+
23
+ core.service.converstaion.sendLastRead(conversation, timestamp, {sendAsProtobuf: true});
24
+ ```
25
+
26
+
27
+
28
+
29
+
30
+ ## [25.3.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@25.3.0...@wireapp/core@25.3.1) (2022-05-16)
31
+
32
+ **Note:** Version bump only for package @wireapp/core
33
+
34
+
35
+
36
+
37
+
38
+ # [25.3.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@25.2.1...@wireapp/core@25.3.0) (2022-05-16)
39
+
40
+
41
+ ### Features
42
+
43
+ * **api-client:** Add MLS clients endpoints ([#4260](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4260)) ([d7bf7c1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/d7bf7c12dfe215e79f57cf99ad91cb7d05b36a12))
44
+
45
+
46
+
47
+
48
+
6
49
  ## [25.2.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@25.2.0...@wireapp/core@25.2.1) (2022-05-11)
7
50
 
8
51
  **Note:** Version bump only for package @wireapp/core
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "dependencies": {
6
6
  "@types/long": "4.0.1",
7
7
  "@types/node": "~14",
8
- "@wireapp/api-client": "19.1.1",
8
+ "@wireapp/api-client": "19.2.0",
9
9
  "@wireapp/cryptobox": "12.8.0",
10
10
  "bazinga64": "5.10.0",
11
11
  "hash.js": "1.1.7",
@@ -69,6 +69,6 @@
69
69
  "test:project": "yarn dist && yarn test",
70
70
  "test:node": "nyc jasmine --config=jasmine.json"
71
71
  },
72
- "version": "25.2.1",
73
- "gitHead": "3bcb0a0f2c4ddbdb5460827b4eb3b84cee05e939"
72
+ "version": "26.0.0",
73
+ "gitHead": "730379c5b3701879632789ca73c1a9d55a9505ad"
74
74
  }
@@ -6,4 +6,6 @@ export declare class ClientBackendRepository {
6
6
  getClients(): Promise<RegisteredClient[]>;
7
7
  postClient(client: CreateClientPayload): Promise<RegisteredClient>;
8
8
  putClient(clientId: string, updates: UpdateClientPayload): Promise<void>;
9
+ deleteClient(clientId: string, password?: string): Promise<void>;
10
+ uploadMLSKeyPackages(clientId: string, keyPackages: string[]): Promise<void>;
9
11
  }
@@ -32,6 +32,12 @@ class ClientBackendRepository {
32
32
  putClient(clientId, updates) {
33
33
  return this.apiClient.api.client.putClient(clientId, updates);
34
34
  }
35
+ deleteClient(clientId, password) {
36
+ return this.apiClient.api.client.deleteClient(clientId, password);
37
+ }
38
+ uploadMLSKeyPackages(clientId, keyPackages) {
39
+ return this.apiClient.api.client.uploadMLSKeyPackages(clientId, keyPackages);
40
+ }
35
41
  }
36
42
  exports.ClientBackendRepository = ClientBackendRepository;
37
43
  //# sourceMappingURL=ClientBackendRepository.js.map
@@ -35,7 +35,7 @@ class ClientDatabaseRepository {
35
35
  return this.storeEngine.read(ClientDatabaseRepository.STORES.CLIENTS, sessionId);
36
36
  }
37
37
  deleteLocalClient() {
38
- return this.storeEngine.delete(ClientDatabaseRepository.STORES.CLIENTS, ClientDatabaseRepository.KEYS.LOCAL_IDENTITY);
38
+ return this.deleteClient(ClientDatabaseRepository.KEYS.LOCAL_IDENTITY);
39
39
  }
40
40
  deleteClient(sessionId) {
41
41
  return this.storeEngine.delete(ClientDatabaseRepository.STORES.CLIENTS, sessionId);
@@ -18,8 +18,21 @@ export declare class ClientService {
18
18
  private readonly database;
19
19
  private readonly backend;
20
20
  constructor(apiClient: APIClient, storeEngine: CRUDEngine, cryptographyService: CryptographyService);
21
- deleteLocalClient(): Promise<string>;
22
21
  getClients(): Promise<RegisteredClient[]>;
22
+ /**
23
+ * Will delete the given client from backend and will also delete it from the local database
24
+ *
25
+ * note: use deleteLocalClient if you wish to delete the client currently used by the user
26
+ *
27
+ * @param clientId The id of the client to delete
28
+ * @param password? Password of the owning user. Can be omitted for temporary devices
29
+ */
30
+ deleteClient(clientId: string, password?: string): Promise<unknown>;
31
+ /**
32
+ * Will delete the local client (client currently in use by the user) from backend and will also delete it from the local database
33
+ * @param password? Password of the owning user. Can be omitted for temporary devices
34
+ */
35
+ deleteLocalClient(password?: string): Promise<string>;
23
36
  getLocalClient(): Promise<MetaClient>;
24
37
  createLocalClient(client: RegisteredClient, domain?: string): Promise<MetaClient>;
25
38
  synchronizeClients(): Promise<MetaClient[]>;
@@ -29,12 +29,35 @@ class ClientService {
29
29
  this.database = new _1.ClientDatabaseRepository(this.storeEngine, this.cryptographyService);
30
30
  this.backend = new _1.ClientBackendRepository(this.apiClient);
31
31
  }
32
- deleteLocalClient() {
33
- return this.database.deleteLocalClient();
34
- }
35
32
  getClients() {
36
33
  return this.backend.getClients();
37
34
  }
35
+ /**
36
+ * Will delete the given client from backend and will also delete it from the local database
37
+ *
38
+ * note: use deleteLocalClient if you wish to delete the client currently used by the user
39
+ *
40
+ * @param clientId The id of the client to delete
41
+ * @param password? Password of the owning user. Can be omitted for temporary devices
42
+ */
43
+ async deleteClient(clientId, password) {
44
+ const userId = { id: this.apiClient.userId, domain: this.apiClient.domain || '' };
45
+ await this.backend.deleteClient(clientId, password);
46
+ return this.database.deleteClient(this.cryptographyService.constructSessionId(userId, clientId));
47
+ }
48
+ /**
49
+ * Will delete the local client (client currently in use by the user) from backend and will also delete it from the local database
50
+ * @param password? Password of the owning user. Can be omitted for temporary devices
51
+ */
52
+ async deleteLocalClient(password) {
53
+ var _a;
54
+ const localClientId = (_a = this.apiClient.context) === null || _a === void 0 ? void 0 : _a.clientId;
55
+ if (!localClientId) {
56
+ throw new Error('Trying to delete local client, but local client has not been set');
57
+ }
58
+ await this.backend.deleteClient(localClientId, password);
59
+ return this.database.deleteLocalClient();
60
+ }
38
61
  getLocalClient() {
39
62
  return this.database.getLocalClient();
40
63
  }
@@ -115,10 +115,10 @@ export declare class ConversationService {
115
115
  *
116
116
  * @param conversationId The conversation which has been read
117
117
  * @param lastReadTimestamp The timestamp at which the conversation was read
118
- * @param sendAsProtobuf?
118
+ * @param sendingOptions?
119
119
  * @return Resolves when the message has been sent
120
120
  */
121
- sendLastRead(conversationId: string, lastReadTimestamp: number, sendAsProtobuf?: boolean): Promise<(MessageSendingStatus & {
121
+ sendLastRead(conversationId: string, lastReadTimestamp: number, sendingOptions?: MessageSendingOptions): Promise<(MessageSendingStatus & {
122
122
  errored?: boolean | undefined;
123
123
  }) | (ClientMismatch & {
124
124
  errored?: boolean | undefined;
@@ -127,10 +127,10 @@ export declare class ConversationService {
127
127
  * Syncs all self user's devices with the countly id
128
128
  *
129
129
  * @param countlyId The countly id of the current device
130
- * @param sendAsProtobuf?
130
+ * @param sendingOptions?
131
131
  * @return Resolves when the message has been sent
132
132
  */
133
- sendCountlySync(countlyId: string, sendAsProtobuf?: boolean): Promise<(MessageSendingStatus & {
133
+ sendCountlySync(countlyId: string, sendingOptions: MessageSendingOptions): Promise<(MessageSendingStatus & {
134
134
  errored?: boolean | undefined;
135
135
  }) | (ClientMismatch & {
136
136
  errored?: boolean | undefined;
@@ -470,10 +470,10 @@ class ConversationService {
470
470
  *
471
471
  * @param conversationId The conversation which has been read
472
472
  * @param lastReadTimestamp The timestamp at which the conversation was read
473
- * @param sendAsProtobuf?
473
+ * @param sendingOptions?
474
474
  * @return Resolves when the message has been sent
475
475
  */
476
- async sendLastRead(conversationId, lastReadTimestamp, sendAsProtobuf) {
476
+ async sendLastRead(conversationId, lastReadTimestamp, sendingOptions) {
477
477
  const lastRead = new protocol_messaging_1.LastRead({
478
478
  conversationId,
479
479
  lastReadTimestamp,
@@ -483,19 +483,16 @@ class ConversationService {
483
483
  messageId: MessageBuilder_1.MessageBuilder.createId(),
484
484
  });
485
485
  const { id: selfConversationId, domain: selfConversationDomain } = await this.getSelfConversationId();
486
- return this.sendGenericMessage(this.apiClient.validatedClientId, selfConversationId, genericMessage, {
487
- conversationDomain: selfConversationDomain,
488
- sendAsProtobuf,
489
- });
486
+ return this.sendGenericMessage(this.apiClient.validatedClientId, selfConversationId, genericMessage, Object.assign({ conversationDomain: selfConversationDomain }, sendingOptions));
490
487
  }
491
488
  /**
492
489
  * Syncs all self user's devices with the countly id
493
490
  *
494
491
  * @param countlyId The countly id of the current device
495
- * @param sendAsProtobuf?
492
+ * @param sendingOptions?
496
493
  * @return Resolves when the message has been sent
497
494
  */
498
- async sendCountlySync(countlyId, sendAsProtobuf) {
495
+ async sendCountlySync(countlyId, sendingOptions) {
499
496
  const { id: selfConversationId, domain: selfConversationDomain } = await this.getSelfConversationId();
500
497
  const dataTransfer = new protocol_messaging_1.DataTransfer({
501
498
  trackingIdentifier: {
@@ -506,10 +503,7 @@ class ConversationService {
506
503
  [conversation_2.GenericMessageType.DATA_TRANSFER]: dataTransfer,
507
504
  messageId: MessageBuilder_1.MessageBuilder.createId(),
508
505
  });
509
- return this.sendGenericMessage(this.apiClient.validatedClientId, selfConversationId, genericMessage, {
510
- conversationDomain: selfConversationDomain,
511
- sendAsProtobuf,
512
- });
506
+ return this.sendGenericMessage(this.apiClient.validatedClientId, selfConversationId, genericMessage, Object.assign({ conversationDomain: selfConversationDomain }, sendingOptions));
513
507
  }
514
508
  /**
515
509
  * Get a fresh list from backend of clients for all the participants of the conversation.