@wireapp/core 30.12.0 → 31.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.
Files changed (53) hide show
  1. package/package.json +28 -22
  2. package/src/main/Account.d.ts +11 -3
  3. package/src/main/Account.js +11 -0
  4. package/src/main/CoreError.d.ts +1 -1
  5. package/src/main/account/AccountService.d.ts +2 -2
  6. package/src/main/account/AccountService.ts +2 -2
  7. package/src/main/auth/LoginSanitizer.d.ts +1 -1
  8. package/src/main/broadcast/AvailabilityType.d.ts +1 -1
  9. package/src/main/broadcast/BroadcastService.d.ts +3 -3
  10. package/src/main/client/ClientBackendRepository.d.ts +2 -2
  11. package/src/main/client/ClientDatabaseRepository.d.ts +3 -3
  12. package/src/main/client/ClientInfo.d.ts +1 -1
  13. package/src/main/client/ClientService.d.ts +4 -4
  14. package/src/main/connection/ConnectionService.d.ts +1 -1
  15. package/src/main/conversation/AbortReason.d.ts +1 -1
  16. package/src/main/conversation/AssetService/AssetService.d.ts +4 -4
  17. package/src/main/conversation/ConversationService/ConversationService.d.ts +9 -28
  18. package/src/main/conversation/ConversationService/ConversationService.js +4 -312
  19. package/src/main/conversation/ConversationService/ConversationService.types.d.ts +2 -0
  20. package/src/main/conversation/ConversationService/messageGenerator.d.ts +9 -0
  21. package/src/main/conversation/ConversationService/messageGenerator.js +301 -0
  22. package/src/main/conversation/message/CompositeContentBuilder.d.ts +1 -1
  23. package/src/main/conversation/message/Message.d.ts +3 -3
  24. package/src/main/conversation/message/MessageBuilder.d.ts +6 -2
  25. package/src/main/conversation/message/MessageBuilder.js +3 -0
  26. package/src/main/conversation/message/MessageToProtoMapper.d.ts +2 -2
  27. package/src/main/conversation/message/OtrMessage.d.ts +2 -2
  28. package/src/main/conversation/message/PayloadBundle.d.ts +3 -3
  29. package/src/main/conversation/message/TeamMessage.d.ts +2 -2
  30. package/src/main/conversation/message/TextContentBuilder.d.ts +1 -1
  31. package/src/main/conversation/message/UserMessage.d.ts +2 -2
  32. package/src/main/cryptography/AssetCryptography/index.d.ts +1 -1
  33. package/src/main/cryptography/CryptographyDatabaseRepository.d.ts +1 -1
  34. package/src/main/cryptography/CryptographyService.d.ts +7 -7
  35. package/src/main/cryptography/GenericMessageMapper.d.ts +1 -1
  36. package/src/main/giphy/GiphyService.d.ts +2 -2
  37. package/src/main/mls/MLSService/MLSService.d.ts +5 -3
  38. package/src/main/mls/MLSService/MLSService.js +35 -10
  39. package/src/main/mls/types.d.ts +11 -0
  40. package/src/main/notification/NotificationBackendRepository.d.ts +2 -2
  41. package/src/main/notification/NotificationDatabaseRepository.d.ts +4 -7
  42. package/src/main/notification/NotificationDatabaseRepository.js +0 -10
  43. package/src/main/notification/NotificationService.d.ts +6 -17
  44. package/src/main/notification/NotificationService.js +15 -27
  45. package/src/main/notification/types.d.ts +0 -4
  46. package/src/main/self/SelfService.d.ts +2 -2
  47. package/src/main/team/TeamService.d.ts +2 -2
  48. package/src/main/test/CryptographyHelper.d.ts +1 -1
  49. package/src/main/user/UserService.d.ts +3 -3
  50. package/src/main/util/TypePredicateUtil.d.ts +2 -2
  51. package/src/main/util/{mapQualifiedUserClientIdsToFullyQualifiedClientIds.d.ts → fullyQualifiedClientIdUtils.d.ts} +5 -0
  52. package/src/main/util/{mapQualifiedUserClientIdsToFullyQualifiedClientIds.js → fullyQualifiedClientIdUtils.js} +12 -2
  53. package/CHANGELOG.md +0 -12408
package/package.json CHANGED
@@ -3,16 +3,14 @@
3
3
  "./src/main/cryptography/AssetCryptography/crypto.node": "./src/main/cryptography/AssetCryptography/crypto.browser.js"
4
4
  },
5
5
  "dependencies": {
6
- "@open-wc/webpack-import-meta-loader": "0.4.7",
7
- "@types/long": "4.0.1",
8
- "@types/node": "~14",
9
- "@wireapp/api-client": "20.4.1",
10
- "@wireapp/commons": "4.3.1",
6
+ "@wireapp/api-client": "workspace:^",
7
+ "@wireapp/commons": "workspace:^",
11
8
  "@wireapp/core-crypto": "0.5.0",
12
9
  "@wireapp/cryptobox": "12.8.0",
13
- "@wireapp/promise-queue": "1.1.2",
14
- "@wireapp/store-engine-dexie": "1.6.10",
15
- "bazinga64": "5.10.0",
10
+ "@wireapp/promise-queue": "workspace:^",
11
+ "@wireapp/store-engine-dexie": "workspace:^",
12
+ "axios": "^0.27.2",
13
+ "bazinga64": "5.11.0",
16
14
  "hash.js": "1.1.7",
17
15
  "http-status-codes": "2.1.4",
18
16
  "idb": "7.0.2",
@@ -22,12 +20,20 @@
22
20
  "uuidjs": "4.2.8"
23
21
  },
24
22
  "devDependencies": {
23
+ "@babel/core": "^7.19.1",
24
+ "@babel/preset-env": "^7.19.1",
25
+ "@babel/preset-typescript": "^7.18.6",
26
+ "@open-wc/webpack-import-meta-loader": "0.4.7",
27
+ "@types/babel__core": "^7",
25
28
  "@types/faker": "5.5.7",
26
29
  "@types/jest": "29.0.3",
27
- "@types/karma": "6.3.1",
30
+ "@types/karma": "6.3.3",
31
+ "@types/long": "4.0.1",
32
+ "@types/node": "^14.18.29",
28
33
  "@types/tough-cookie": "4.0.2",
29
- "@wireapp/commons": "4.3.0",
30
- "@wireapp/store-engine-dexie": "1.6.10",
34
+ "@wireapp/commons": "workspace:^",
35
+ "@wireapp/protocol-messaging": "1.38.0",
36
+ "@wireapp/store-engine-dexie": "workspace:^",
31
37
  "commander": "8.0.0",
32
38
  "cross-env": "7.0.3",
33
39
  "dotenv-defaults": "2.0.2",
@@ -37,12 +43,12 @@
37
43
  "jest": "29.0.3",
38
44
  "jest-babel": "1.0.1",
39
45
  "jest-jasmine2": "29.0.3",
40
- "karma": "6.3.16",
41
- "karma-chrome-launcher": "3.1.0",
42
- "karma-jasmine": "4.0.1",
46
+ "karma": "6.4.1",
47
+ "karma-chrome-launcher": "3.1.1",
48
+ "karma-jasmine": "4.0.2",
43
49
  "karma-jasmine-diff-reporter": "2.0.1",
44
50
  "karma-sourcemap-loader": "0.3.8",
45
- "karma-spec-reporter": "0.0.32",
51
+ "karma-spec-reporter": "0.0.34",
46
52
  "mock-socket": "9.0.3",
47
53
  "nock": "13.1.1",
48
54
  "nyc": "15.1.0",
@@ -65,16 +71,16 @@
65
71
  "scripts": {
66
72
  "build": "tsc",
67
73
  "clean": "rimraf .tmp \"src/main/{!(*.test*).js,*.js.map,*.d.ts}\" \"src/main/test/{*.js.map,*.d.ts}\" \"src/main/!(test)/{!(*.test*).js,*.js.map,*.d.ts}\" \"src/main/**/{!(*.test*|AccountHelper|StoreHelper).js,*.js.map,*.d.ts}\" \"src/main/**/*.node.js\"",
68
- "coverage": "cross-env JASMINE_CONFIG_PATH=src/test/node/support/jasmine.json istanbul cover --report html ../../node_modules/jasmine/bin/jasmine.js",
69
- "demo:composite": "cross-env NODE_DEBUG=@wireapp* ts-node src/demo/composite.ts",
70
- "demo:sendCounter": "cross-env NODE_DEBUG=@wireapp* ts-node src/demo/sendCounter.ts",
74
+ "coverage": "cross-env JASMINE_CONFIG_PATH=src/test/node/support/jasmine.json istanbul cover --report html node_modules/jasmine/bin/jasmine.js",
75
+ "demo:composite": "cross-env NODE_DEBUG='@wireapp*' ts-node src/demo/composite.ts",
76
+ "demo:sendCounter": "cross-env NODE_DEBUG='@wireapp*' ts-node src/demo/sendCounter.ts",
71
77
  "dist": "yarn clean && yarn build",
72
78
  "start": "yarn dist && node index.js",
73
- "start:echo": "cross-env NODE_DEBUG=@wireapp/core* node src/demo/echo.js",
74
- "start:sender": "cross-env NODE_DEBUG=@wireapp/core* node src/demo/sender.js",
79
+ "start:echo": "cross-env NODE_DEBUG='@wireapp/core*' node src/demo/echo.js",
80
+ "start:sender": "cross-env NODE_DEBUG='@wireapp/core*' node src/demo/sender.js",
75
81
  "test": "jest",
76
82
  "watch": "tsc ---watch"
77
83
  },
78
- "version": "30.12.0",
79
- "gitHead": "edc6fac3ddb27f77cf2238a1480559235313fe64"
84
+ "version": "31.0.0",
85
+ "gitHead": "a23001a062060cec72d2e3687e381c8ae6ca31a7"
80
86
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { APIClient, BackendFeatures } from '@wireapp/api-client';
3
- import type { RegisterData } from '@wireapp/api-client/src/auth';
3
+ import { RegisterData } from '@wireapp/api-client/src/auth';
4
4
  import { Context, Cookie, LoginData } from '@wireapp/api-client/src/auth/';
5
5
  import { ClientType, RegisteredClient } from '@wireapp/api-client/src/client/';
6
6
  import * as Events from '@wireapp/api-client/src/event';
@@ -12,7 +12,7 @@ import { ConnectionService } from './connection/';
12
12
  import { AssetService, ConversationService, PayloadBundleSource, PayloadBundleType } from './conversation/';
13
13
  import * as OtrMessage from './conversation/message/OtrMessage';
14
14
  import * as UserMessage from './conversation/message/UserMessage';
15
- import type { CoreError } from './CoreError';
15
+ import { CoreError } from './CoreError';
16
16
  import { CryptographyService } from './cryptography/';
17
17
  import { GiphyService } from './giphy/';
18
18
  import { HandledEventPayload, NotificationService } from './notification/';
@@ -23,7 +23,7 @@ import { AccountService } from './account/';
23
23
  import { LinkPreviewService } from './linkPreview';
24
24
  import { WEBSOCKET_STATE } from '@wireapp/api-client/src/tcp/ReconnectingWebsocket';
25
25
  import { MLSService } from './mls';
26
- import type { MLSConfig } from './mls/types';
26
+ import { MLSCallbacks, MLSConfig } from './mls/types';
27
27
  export declare type ProcessedEventPayload = HandledEventPayload;
28
28
  declare enum TOPIC {
29
29
  ERROR = "Account.TOPIC.ERROR"
@@ -147,6 +147,14 @@ export declare class Account<T = any> extends EventEmitter {
147
147
  isNewClient: boolean;
148
148
  localClient: RegisteredClient;
149
149
  }>;
150
+ /**
151
+ * In order to be able to send MLS messages, the core needs a few information from the consumer.
152
+ * Namely:
153
+ * - is the current user allowed to administrate a specific conversation
154
+ * - what is the groupId of a conversation
155
+ * @param mlsCallbacks
156
+ */
157
+ configureMLSCallbacks(mlsCallbacks: MLSCallbacks): void;
150
158
  initServices(context: Context): Promise<void>;
151
159
  loadAndValidateLocalClient(entropyData?: Uint8Array): Promise<RegisteredClient>;
152
160
  private createMLSClient;
@@ -232,6 +232,17 @@ class Account extends events_1.EventEmitter {
232
232
  throw error;
233
233
  }
234
234
  }
235
+ /**
236
+ * In order to be able to send MLS messages, the core needs a few information from the consumer.
237
+ * Namely:
238
+ * - is the current user allowed to administrate a specific conversation
239
+ * - what is the groupId of a conversation
240
+ * @param mlsCallbacks
241
+ */
242
+ configureMLSCallbacks(mlsCallbacks) {
243
+ var _a;
244
+ (_a = this.service) === null || _a === void 0 ? void 0 : _a.mls.configureMLSCallbacks(mlsCallbacks);
245
+ }
235
246
  async initServices(context) {
236
247
  this.storeEngine = await this.initEngine(context);
237
248
  const accountService = new account_1.AccountService(this.apiClient);
@@ -1,4 +1,4 @@
1
- import type { Notification } from '@wireapp/api-client/src/notification';
1
+ import { Notification } from '@wireapp/api-client/src/notification';
2
2
  export declare enum CoreError {
3
3
  NOTIFICATION_ERROR = "CoreError.NOTIFICATION_ERROR"
4
4
  }
@@ -1,5 +1,5 @@
1
- import type { APIClient } from '@wireapp/api-client';
2
- import type { CallConfigData } from '@wireapp/api-client/src/account/CallConfigData';
1
+ import { APIClient } from '@wireapp/api-client';
2
+ import { CallConfigData } from '@wireapp/api-client/src/account/CallConfigData';
3
3
  export declare class AccountService {
4
4
  private readonly apiClient;
5
5
  constructor(apiClient: APIClient);
@@ -17,9 +17,9 @@
17
17
  *
18
18
  */
19
19
 
20
- import type {APIClient} from '@wireapp/api-client';
20
+ import {APIClient} from '@wireapp/api-client';
21
21
  import {Runtime} from '@wireapp/commons';
22
- import type {CallConfigData} from '@wireapp/api-client/src/account/CallConfigData';
22
+ import {CallConfigData} from '@wireapp/api-client/src/account/CallConfigData';
23
23
 
24
24
  export class AccountService {
25
25
  constructor(private readonly apiClient: APIClient) {}
@@ -1,4 +1,4 @@
1
- import type { LoginData } from '@wireapp/api-client/src/auth/';
1
+ import { LoginData } from '@wireapp/api-client/src/auth/';
2
2
  export declare class LoginSanitizer {
3
3
  constructor();
4
4
  static removeNonPrintableCharacters(loginData: LoginData): void;
@@ -1,2 +1,2 @@
1
- import type { Availability } from '@wireapp/protocol-messaging';
1
+ import { Availability } from '@wireapp/protocol-messaging';
2
2
  export declare type AvailabilityType = Availability.Type;
@@ -1,8 +1,8 @@
1
- import type { APIClient } from '@wireapp/api-client';
1
+ import { APIClient } from '@wireapp/api-client';
2
2
  import { ClientMismatch, MessageSendingStatus, QualifiedUserClients, UserClients } from '@wireapp/api-client/src/conversation';
3
- import type { UserPreKeyBundleMap } from '@wireapp/api-client/src/user/';
3
+ import { UserPreKeyBundleMap } from '@wireapp/api-client/src/user/';
4
4
  import { GenericMessage } from '@wireapp/protocol-messaging';
5
- import type { CryptographyService } from '../cryptography/';
5
+ import { CryptographyService } from '../cryptography/';
6
6
  export declare class BroadcastService {
7
7
  private readonly apiClient;
8
8
  private readonly cryptographyService;
@@ -1,5 +1,5 @@
1
- import type { APIClient } from '@wireapp/api-client';
2
- import type { CreateClientPayload, RegisteredClient, UpdateClientPayload } from '@wireapp/api-client/src/client/';
1
+ import { APIClient } from '@wireapp/api-client';
2
+ import { CreateClientPayload, RegisteredClient, UpdateClientPayload } from '@wireapp/api-client/src/client/';
3
3
  export declare class ClientBackendRepository {
4
4
  private readonly apiClient;
5
5
  constructor(apiClient: APIClient);
@@ -1,7 +1,7 @@
1
- import type { RegisteredClient } from '@wireapp/api-client/src/client/';
2
- import type { CRUDEngine } from '@wireapp/store-engine';
1
+ import { RegisteredClient } from '@wireapp/api-client/src/client/';
2
+ import { CRUDEngine } from '@wireapp/store-engine';
3
3
  import { CryptographyService } from '../cryptography/';
4
- import type { MetaClient } from './ClientService';
4
+ import { MetaClient } from './ClientService';
5
5
  export declare enum DatabaseStores {
6
6
  CLIENTS = "clients"
7
7
  }
@@ -1,4 +1,4 @@
1
- import type { ClientClassification, Location } from '@wireapp/api-client/src/client/';
1
+ import { ClientClassification, Location } from '@wireapp/api-client/src/client/';
2
2
  export interface ClientInfo {
3
3
  classification: ClientClassification.DESKTOP | ClientClassification.PHONE | ClientClassification.TABLET;
4
4
  cookieLabel: string;
@@ -1,8 +1,8 @@
1
- import type { APIClient } from '@wireapp/api-client';
2
- import type { LoginData } from '@wireapp/api-client/src/auth/';
1
+ import { APIClient } from '@wireapp/api-client';
2
+ import { LoginData } from '@wireapp/api-client/src/auth/';
3
3
  import { RegisteredClient } from '@wireapp/api-client/src/client/';
4
- import type { CRUDEngine } from '@wireapp/store-engine';
5
- import type { CryptographyService } from '../cryptography/';
4
+ import { CRUDEngine } from '@wireapp/store-engine';
5
+ import { CryptographyService } from '../cryptography/';
6
6
  import { ClientInfo } from './';
7
7
  export interface MetaClient extends RegisteredClient {
8
8
  domain?: string;
@@ -1,4 +1,4 @@
1
- import type { APIClient } from '@wireapp/api-client';
1
+ import { APIClient } from '@wireapp/api-client';
2
2
  import { Connection } from '@wireapp/api-client/src/connection/';
3
3
  import { QualifiedId } from '@wireapp/api-client/src/user';
4
4
  export declare class ConnectionService {
@@ -1,2 +1,2 @@
1
- import type { Asset } from '@wireapp/protocol-messaging';
1
+ import { Asset } from '@wireapp/protocol-messaging';
2
2
  export declare type AbortReason = Asset.NotUploaded;
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
- import type { APIClient } from '@wireapp/api-client';
3
- import type { AssetOptions } from '@wireapp/api-client/src/asset';
4
- import type { ProgressCallback, RequestCancelable } from '@wireapp/api-client/src/http';
5
- import type { EncryptedAssetUploaded } from '../../cryptography';
2
+ import { APIClient } from '@wireapp/api-client';
3
+ import { AssetOptions } from '@wireapp/api-client/src/asset';
4
+ import { ProgressCallback, RequestCancelable } from '@wireapp/api-client/src/http';
5
+ import { EncryptedAssetUploaded } from '../../cryptography';
6
6
  export interface AssetDataV4 {
7
7
  assetKey: string;
8
8
  assetToken: string;
@@ -1,15 +1,15 @@
1
- import type { APIClient } from '@wireapp/api-client';
1
+ import { APIClient } from '@wireapp/api-client';
2
2
  import { MessageSendingStatus, Conversation, DefaultConversationRoleName, MutedStatus, NewConversation, QualifiedUserClients, UserClients, ClientMismatch } from '@wireapp/api-client/src/conversation';
3
- import type { ConversationMemberLeaveEvent } from '@wireapp/api-client/src/event';
4
- import type { QualifiedId, UserPreKeyBundleMap } from '@wireapp/api-client/src/user';
3
+ import { ConversationMemberLeaveEvent } from '@wireapp/api-client/src/event';
4
+ import { QualifiedId, UserPreKeyBundleMap } from '@wireapp/api-client/src/user';
5
5
  import { MessageTimer, RemoveUsersParams } from '../../conversation/';
6
- import type { RemoteData } from '../content';
7
- import type { CryptographyService } from '../../cryptography/';
8
- import type { MLSService } from '../../mls';
9
- import type { NotificationService } from '../../notification';
10
- import type { ClearConversationMessage, DeleteMessage, HideMessage, OtrMessage } from '../message/OtrMessage';
6
+ import { RemoteData } from '../content';
7
+ import { CryptographyService } from '../../cryptography/';
8
+ import { MLSService } from '../../mls';
9
+ import { NotificationService } from '../../notification';
10
+ import { ClearConversationMessage, HideMessage, OtrMessage } from '../message/OtrMessage';
11
11
  import { XOR } from '@wireapp/commons/src/main/util/TypeUtil';
12
- import { AddUsersParams, MessageSendingCallbacks, MessageSendingOptions, MLSReturnType, SendMlsMessageParams, SendProteusMessageParams } from './ConversationService.types';
12
+ import { AddUsersParams, MessageSendingOptions, MLSReturnType, SendMlsMessageParams, SendProteusMessageParams } from './ConversationService.types';
13
13
  export declare class ConversationService {
14
14
  private readonly apiClient;
15
15
  private readonly config;
@@ -21,7 +21,6 @@ export declare class ConversationService {
21
21
  constructor(apiClient: APIClient, cryptographyService: CryptographyService, config: {
22
22
  useQualifiedIds?: boolean;
23
23
  }, notificationService: NotificationService, mlsService: MLSService);
24
- private createEphemeral;
25
24
  private getConversationQualifiedMembers;
26
25
  /**
27
26
  * Will generate a prekey bundle for specific users.
@@ -47,22 +46,6 @@ export declare class ConversationService {
47
46
  private sendGenericMessage;
48
47
  private extractUserIds;
49
48
  private extractQualifiedUserIds;
50
- private generateButtonActionGenericMessage;
51
- private generateButtonActionConfirmationGenericMessage;
52
- private generateCompositeGenericMessage;
53
- private generateConfirmationGenericMessage;
54
- private generateEditedTextGenericMessage;
55
- private generateFileDataGenericMessage;
56
- private generateFileMetaDataGenericMessage;
57
- private generateFileAbortGenericMessage;
58
- private generateAsset;
59
- private generateImageGenericMessage;
60
- private generateLocationGenericMessage;
61
- private generatePingGenericMessage;
62
- private generateReactionGenericMessage;
63
- private generateSessionResetGenericMessage;
64
- private generateCallGenericMessage;
65
- private generateTextGenericMessage;
66
49
  clearConversation(conversationId: string, timestamp?: number | Date, messageId?: string, sendAsProtobuf?: boolean): Promise<ClearConversationMessage>;
67
50
  /**
68
51
  * Sends a LastRead message to the current user's self conversation.
@@ -109,7 +92,6 @@ export declare class ConversationService {
109
92
  */
110
93
  fetchAllParticipantsClients(conversationId: string, conversationDomain?: string): Promise<UserClients | QualifiedUserClients>;
111
94
  deleteMessageLocal(conversationId: string, messageIdToHide: string, sendAsProtobuf?: boolean, conversationDomain?: string): Promise<HideMessage>;
112
- deleteMessageEveryone(conversationId: string, messageIdToDelete: string, userIds?: string[] | QualifiedId[] | UserClients | QualifiedUserClients, sendAsProtobuf?: boolean, conversationDomain?: string, callbacks?: MessageSendingCallbacks): Promise<DeleteMessage>;
113
95
  /**
114
96
  * Create a group conversation.
115
97
  * @param {string} name
@@ -146,7 +128,6 @@ export declare class ConversationService {
146
128
  toggleArchiveConversation(conversationId: string, archived: boolean, archiveTimestamp?: number | Date): Promise<void>;
147
129
  setMemberConversationRole(conversationId: string, userId: string, conversationRole: DefaultConversationRoleName | string): Promise<void>;
148
130
  private isClearFromMismatch;
149
- private generateGenericMessage;
150
131
  /**
151
132
  * ###############################################
152
133
  * ################ MLS Functions ################