@wireapp/core 38.6.0 → 38.7.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 (50) hide show
  1. package/lib/Account.d.ts +10 -10
  2. package/lib/Account.d.ts.map +1 -1
  3. package/lib/Account.js +6 -2
  4. package/lib/messagingProtocols/mls/EventHandler/EventHandler.d.ts +1 -1
  5. package/lib/messagingProtocols/mls/EventHandler/EventHandler.d.ts.map +1 -1
  6. package/lib/messagingProtocols/mls/EventHandler/EventHandler.js +10 -2
  7. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/index.d.ts +0 -0
  8. package/lib/messagingProtocols/mls/EventHandler/events/index.d.ts.map +1 -0
  9. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/index.js +0 -0
  10. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/messageAdd/index.d.ts +0 -0
  11. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts.map +1 -0
  12. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/messageAdd/index.js +0 -0
  13. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/messageAdd/messageAdd.d.ts +3 -5
  14. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -0
  15. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/messageAdd/messageAdd.js +6 -14
  16. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/messageAdd/messageAdd.test.d.ts +0 -0
  17. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts.map +1 -0
  18. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/messageAdd/messageAdd.test.js +0 -0
  19. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/welcomeMessage/index.d.ts +0 -0
  20. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/index.d.ts.map +1 -0
  21. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/welcomeMessage/index.js +0 -0
  22. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/welcomeMessage/welcomeMessage.d.ts +2 -2
  23. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map +1 -0
  24. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/welcomeMessage/welcomeMessage.js +0 -0
  25. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/welcomeMessage/welcomeMessage.test.d.ts +0 -0
  26. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.d.ts.map +1 -0
  27. package/lib/messagingProtocols/mls/EventHandler/{ConversationEvent/events → events}/welcomeMessage/welcomeMessage.test.js +0 -0
  28. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +9 -1
  29. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
  30. package/lib/messagingProtocols/mls/MLSService/MLSService.js +8 -3
  31. package/lib/notification/NotificationService.d.ts +8 -6
  32. package/lib/notification/NotificationService.d.ts.map +1 -1
  33. package/lib/notification/NotificationService.js +2 -2
  34. package/lib/util/TypedEventEmitter.d.ts +9 -0
  35. package/lib/util/TypedEventEmitter.d.ts.map +1 -0
  36. package/lib/util/TypedEventEmitter.js +37 -0
  37. package/package.json +2 -2
  38. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/ConversationEvent.d.ts +0 -5
  39. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/ConversationEvent.d.ts.map +0 -1
  40. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/ConversationEvent.js +0 -37
  41. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/index.d.ts.map +0 -1
  42. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/index.d.ts.map +0 -1
  43. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/messageAdd.d.ts.map +0 -1
  44. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/messageAdd.test.d.ts.map +0 -1
  45. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/welcomeMessage/index.d.ts.map +0 -1
  46. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/welcomeMessage/welcomeMessage.d.ts.map +0 -1
  47. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/welcomeMessage/welcomeMessage.test.d.ts.map +0 -1
  48. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/index.d.ts +0 -2
  49. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/index.d.ts.map +0 -1
  50. package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/index.js +0 -35
package/lib/Account.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- /// <reference types="node" />
2
1
  import { RegisterData, Context, Cookie, LoginData } from '@wireapp/api-client/lib/auth';
3
2
  import { ClientType, RegisteredClient } from '@wireapp/api-client/lib/client/';
4
- import { EventEmitter } from 'events';
3
+ import * as Events from '@wireapp/api-client/lib/event';
5
4
  import { APIClient, BackendFeatures } from '@wireapp/api-client';
6
5
  import { CRUDEngine } from '@wireapp/store-engine';
7
6
  import { AccountService } from './account/';
@@ -18,8 +17,13 @@ import { HandledEventPayload, NotificationService, NotificationSource } from './
18
17
  import { SelfService } from './self/';
19
18
  import { TeamService } from './team/';
20
19
  import { UserService } from './user/';
20
+ import { TypedEventEmitter } from './util/TypedEventEmitter';
21
21
  export type ProcessedEventPayload = HandledEventPayload;
22
22
  export declare enum EVENTS {
23
+ /**
24
+ * event triggered when a message from an unknown client is received.
25
+ * An unknown client is a client we don't yet have a session with
26
+ */
23
27
  NEW_SESSION = "new_session"
24
28
  }
25
29
  export declare enum ConnectionState {
@@ -32,13 +36,6 @@ export declare enum ConnectionState {
32
36
  /** The websocket is open and message will go through and notifications stream is fully processed */
33
37
  LIVE = "live"
34
38
  }
35
- export interface Account {
36
- /**
37
- * event triggered when a message from an unknown client is received.
38
- * An unknown client is a client we don't yet have a session with
39
- */
40
- on(event: EVENTS.NEW_SESSION, listener: (client: NewClient) => void): this;
41
- }
42
39
  export type CreateStoreFn = (storeName: string, context: Context) => undefined | Promise<CRUDEngine | undefined>;
43
40
  interface AccountOptions<T> {
44
41
  /** Used to store info in the database (will create a inMemory engine if returns undefined) */
@@ -62,7 +59,10 @@ type InitOptions = {
62
59
  /** cookie used to identify the current user. Will use the browser cookie if not defined */
63
60
  cookie?: Cookie;
64
61
  };
65
- export declare class Account<T = any> extends EventEmitter {
62
+ type Events = {
63
+ [EVENTS.NEW_SESSION]: NewClient;
64
+ };
65
+ export declare class Account<T = any> extends TypedEventEmitter<Events> {
66
66
  private readonly apiClient;
67
67
  private readonly logger;
68
68
  private readonly createStore;
@@ -1 +1 @@
1
- {"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../src/Account.ts"],"names":[],"mappings":";AAmBA,OAAO,EACL,YAAY,EAGZ,OAAO,EACP,MAAM,EAEN,SAAS,EACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAuB,UAAU,EAAE,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAQnG,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAe,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAC,YAAY,EAAC,MAAM,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CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;QAE5D;;;;;;WAMG;QACH,qBAAqB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;QAEzD;;WAEG;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;KACb,GAAG,MAAM,IAAI;IA2FnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,kBAAkB;YAIZ,UAAU;CAqBzB"}
package/lib/Account.js CHANGED
@@ -35,7 +35,6 @@ const event_1 = require("@wireapp/api-client/lib/event");
35
35
  const tcp_1 = require("@wireapp/api-client/lib/tcp/");
36
36
  const ReconnectingWebsocket_1 = require("@wireapp/api-client/lib/tcp/ReconnectingWebsocket");
37
37
  const logdown_1 = __importDefault(require("logdown"));
38
- const events_1 = require("events");
39
38
  const api_client_1 = require("@wireapp/api-client");
40
39
  const store_engine_1 = require("@wireapp/store-engine");
41
40
  const account_1 = require("./account/");
@@ -56,8 +55,13 @@ const CoreDB_1 = require("./storage/CoreDB");
56
55
  const team_1 = require("./team/");
57
56
  const user_1 = require("./user/");
58
57
  const encryptedStore_1 = require("./util/encryptedStore");
58
+ const TypedEventEmitter_1 = require("./util/TypedEventEmitter");
59
59
  var EVENTS;
60
60
  (function (EVENTS) {
61
+ /**
62
+ * event triggered when a message from an unknown client is received.
63
+ * An unknown client is a client we don't yet have a session with
64
+ */
61
65
  EVENTS["NEW_SESSION"] = "new_session";
62
66
  })(EVENTS = exports.EVENTS || (exports.EVENTS = {}));
63
67
  var ConnectionState;
@@ -76,7 +80,7 @@ const coreDefaultClient = {
76
80
  cookieLabel: 'default',
77
81
  model: '@wireapp/core',
78
82
  };
79
- class Account extends events_1.EventEmitter {
83
+ class Account extends TypedEventEmitter_1.TypedEventEmitter {
80
84
  /**
81
85
  * @param apiClient The apiClient instance to use in the core (will create a new new one if undefined)
82
86
  * @param accountOptions
@@ -1,5 +1,5 @@
1
1
  import { EventHandlerParams } from './EventHandler.types';
2
2
  import { EventHandlerResult } from '../../common.types';
3
- declare const handleBackendEvent: (params: EventHandlerParams) => EventHandlerResult;
3
+ declare const handleBackendEvent: (params: EventHandlerParams, onEpochChanged: (groupId: string) => void) => EventHandlerResult;
4
4
  export { handleBackendEvent };
5
5
  //# sourceMappingURL=EventHandler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EventHandler.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/EventHandler/EventHandler.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAEtD,QAAA,MAAM,kBAAkB,WAAkB,kBAAkB,uBAAwD,CAAC;AAErH,OAAO,EAAC,kBAAkB,EAAC,CAAC"}
1
+ {"version":3,"file":"EventHandler.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/EventHandler/EventHandler.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAEtD,QAAA,MAAM,kBAAkB,WACd,kBAAkB,4BACA,MAAM,KAAK,IAAI,uBAS1C,CAAC;AAEF,OAAO,EAAC,kBAAkB,EAAC,CAAC"}
@@ -19,6 +19,14 @@
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.handleBackendEvent = void 0;
22
- const ConversationEvent_1 = require("./ConversationEvent");
23
- const handleBackendEvent = async (params) => (0, ConversationEvent_1.handleConversationEvent)(params);
22
+ const events_1 = require("./events");
23
+ const handleBackendEvent = async (params, onEpochChanged) => {
24
+ const { event } = params;
25
+ if ((0, events_1.isWelcomeMessageEvent)(event)) {
26
+ return (0, events_1.handleWelcomeMessage)(Object.assign(Object.assign({}, params), { event }));
27
+ }
28
+ if ((0, events_1.isMLSMessageAddEvent)(event)) {
29
+ return (0, events_1.handleMLSMessageAdd)(Object.assign(Object.assign({}, params), { event }), onEpochChanged);
30
+ }
31
+ };
24
32
  exports.handleBackendEvent = handleBackendEvent;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/EventHandler/events/index.ts"],"names":[],"mappings":"AAmBA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/index.ts"],"names":[],"mappings":"AAmBA,cAAc,cAAc,CAAC"}
@@ -1,12 +1,10 @@
1
1
  import { BackendEvent, ConversationMLSMessageAddEvent } from '@wireapp/api-client/lib/event';
2
- import logdown from 'logdown';
3
- import { EventHandlerResult } from '../../../../../common.types';
4
- import { EventHandlerParams } from '../../../EventHandler.types';
2
+ import { EventHandlerResult } from '../../../../common.types';
3
+ import { EventHandlerParams } from '../../EventHandler.types';
5
4
  declare const isMLSMessageAddEvent: (event: BackendEvent) => event is ConversationMLSMessageAddEvent;
6
5
  interface HandleMLSMessageAddParams extends EventHandlerParams {
7
6
  event: ConversationMLSMessageAddEvent;
8
- logger: logdown.Logger;
9
7
  }
10
- declare const handleMLSMessageAdd: ({ mlsService, event, logger }: HandleMLSMessageAddParams) => EventHandlerResult;
8
+ declare const handleMLSMessageAdd: ({ mlsService, event }: HandleMLSMessageAddParams, onEpochChanged: (groupId: string) => void) => EventHandlerResult;
11
9
  export { isMLSMessageAddEvent, handleMLSMessageAdd };
12
10
  //# sourceMappingURL=messageAdd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageAdd.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,8BAA8B,EAAqB,MAAM,+BAA+B,CAAC;AAK/G,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE5D,QAAA,MAAM,oBAAoB,UAAW,YAAY,4CACE,CAAC;AAEpD,UAAU,yBAA0B,SAAQ,kBAAkB;IAC5D,KAAK,EAAE,8BAA8B,CAAC;CACvC;AACD,QAAA,MAAM,mBAAmB,0BACF,yBAAyB,4BACpB,MAAM,KAAK,IAAI,uBAuC1C,CAAC;AAEF,OAAO,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,CAAC"}
@@ -22,15 +22,15 @@ exports.handleMLSMessageAdd = exports.isMLSMessageAddEvent = void 0;
22
22
  const event_1 = require("@wireapp/api-client/lib/event");
23
23
  const bazinga64_1 = require("bazinga64");
24
24
  const protocol_messaging_1 = require("@wireapp/protocol-messaging");
25
- const MLSService_1 = require("../../../../MLSService/MLSService");
25
+ const MLSService_1 = require("../../../MLSService/MLSService");
26
26
  const isMLSMessageAddEvent = (event) => event.type === event_1.CONVERSATION_EVENT.MLS_MESSAGE_ADD;
27
27
  exports.isMLSMessageAddEvent = isMLSMessageAddEvent;
28
- const handleMLSMessageAdd = async ({ mlsService, event, logger }) => {
28
+ const handleMLSMessageAdd = async ({ mlsService, event }, onEpochChanged) => {
29
29
  var _a;
30
30
  const encryptedData = bazinga64_1.Decoder.fromBase64(event.data).asBytes;
31
31
  const groupId = await mlsService.getGroupIdFromConversationId((_a = event.qualified_conversation) !== null && _a !== void 0 ? _a : { id: event.conversation, domain: '' }, event.subconv);
32
32
  const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
33
- const { proposals, commitDelay, message, senderClientId: encodedSenderClientId, } = await mlsService.decryptMessage(groupIdBytes, encryptedData);
33
+ const { proposals, commitDelay, message, senderClientId: encodedSenderClientId, hasEpochChanged, } = await mlsService.decryptMessage(groupIdBytes, encryptedData);
34
34
  if (encodedSenderClientId) {
35
35
  const decoder = new TextDecoder();
36
36
  const senderClientId = decoder.decode((0, MLSService_1.optionalToUint8Array)(encodedSenderClientId));
@@ -45,18 +45,10 @@ const handleMLSMessageAdd = async ({ mlsService, event, logger }) => {
45
45
  delayInMs: commitDelay !== null && commitDelay !== void 0 ? commitDelay : 0,
46
46
  eventTime: event.time,
47
47
  });
48
- // This is not a text message, there is nothing more to do
49
- return;
50
48
  }
51
- if (!message) {
52
- const newEpoch = await mlsService.getEpoch(groupIdBytes);
53
- logger.log(`Received commit message for group "${groupId}". New epoch is "${newEpoch}"`);
54
- return;
49
+ if (hasEpochChanged) {
50
+ onEpochChanged(groupId);
55
51
  }
56
- const decryptedData = protocol_messaging_1.GenericMessage.decode(message);
57
- return {
58
- event,
59
- decryptedData,
60
- };
52
+ return message ? { event, decryptedData: protocol_messaging_1.GenericMessage.decode(message) } : undefined;
61
53
  };
62
54
  exports.handleMLSMessageAdd = handleMLSMessageAdd;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageAdd.test.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/welcomeMessage/index.ts"],"names":[],"mappings":"AAmBA,cAAc,kBAAkB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { BackendEvent, ConversationMLSWelcomeEvent } from '@wireapp/api-client/lib/event';
2
- import { EventHandlerResult } from '../../../../../common.types';
3
- import { EventHandlerParams } from '../../../EventHandler.types';
2
+ import { EventHandlerResult } from '../../../../common.types';
3
+ import { EventHandlerParams } from '../../EventHandler.types';
4
4
  declare const isWelcomeMessageEvent: (event: BackendEvent) => event is ConversationMLSWelcomeEvent;
5
5
  interface HandleWelcomeMessageParams extends EventHandlerParams {
6
6
  event: ConversationMLSWelcomeEvent;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"welcomeMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,2BAA2B,EAAqB,MAAM,+BAA+B,CAAC;AAG5G,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE5D,QAAA,MAAM,qBAAqB,UAAW,YAAY,yCACK,CAAC;AAExD,UAAU,0BAA2B,SAAQ,kBAAkB;IAC7D,KAAK,EAAE,2BAA2B,CAAC;CACpC;AACD,QAAA,MAAM,oBAAoB,0BAA+B,0BAA0B,uBASlF,CAAC;AAEF,OAAO,EAAC,qBAAqB,EAAE,oBAAoB,EAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"welcomeMessage.test.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.ts"],"names":[],"mappings":""}
@@ -6,11 +6,18 @@ import { APIClient } from '@wireapp/api-client';
6
6
  import { AddProposalArgs, ConversationId, CoreCrypto, DecryptedMessage, ExternalProposalArgs, ExternalProposalType, ExternalRemoveProposalArgs, Invitee, ProposalArgs, ProposalType, RemoveProposalArgs } from '@wireapp/core-crypto';
7
7
  import { MLSServiceConfig } from './MLSService.types';
8
8
  import { QualifiedUsers } from '../../../conversation';
9
+ import { TypedEventEmitter } from '../../../util/TypedEventEmitter';
9
10
  import { EventHandlerResult } from '../../common.types';
10
11
  import { EventHandlerParams } from '../EventHandler';
11
12
  import { CommitPendingProposalsParams, HandlePendingProposalsParams, MLSCallbacks } from '../types';
12
13
  export declare const optionalToUint8Array: (array: Uint8Array | []) => Uint8Array;
13
- export declare class MLSService {
14
+ type Events = {
15
+ newEpoch: {
16
+ epoch: number;
17
+ groupId: string;
18
+ };
19
+ };
20
+ export declare class MLSService extends TypedEventEmitter<Events> {
14
21
  private readonly apiClient;
15
22
  private readonly coreCryptoClient;
16
23
  logger: logdown.Logger;
@@ -147,4 +154,5 @@ export declare class MLSService {
147
154
  domain: string;
148
155
  }[]>;
149
156
  }
157
+ export {};
150
158
  //# sourceMappingURL=MLSService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,sBAAsB,EAAqB,MAAM,sCAAsC,CAAC;AAChG,OAAO,EAAC,eAAe,EAAC,MAAM,sDAAsD,CAAC;AACrF,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAGzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EACL,eAAe,EAGf,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAC,gBAAgB,EAAsB,MAAM,oBAAoB,CAAC;AAKzE,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAKrD,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAqB,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAC,4BAA4B,EAAE,4BAA4B,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAIlG,eAAO,MAAM,oBAAoB,UAAW,UAAU,GAAG,EAAE,KAAG,UAE7D,CAAC;AAOF,qBAAa,UAAU;IAMnB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IANnC,MAAM,iBAAuC;IAC7C,MAAM,EAAE,gBAAgB,CAAC;IACzB,yBAAyB,CAAC,EAAE,YAAY,CAAC,2BAA2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B,gBAAgB,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/D,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,GAAG,kBAAkB;IAO5F;;;;;OAKG;IACU,4BAA4B,CACvC,uBAAuB,EAAE,WAAW,EACpC,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,MAAM,CAAC;IAYlB;;;;;;;OAOG;IACU,sBAAsB,CAAC,EAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,4BAA4B;IAoBjG;;;;;OAKG;IACU,sBAAsB,CAAC,EAAC,OAAO,EAAE,UAAkB,EAAC,EAAE,4BAA4B;IAa/F;;;;OAIG;IACU,6BAA6B;IAiB1C;;;;OAIG;IACU,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;CAY1G"}
@@ -46,6 +46,7 @@ const messageSender_1 = require("../../../conversation/message/messageSender");
46
46
  const fullyQualifiedClientIdUtils_1 = require("../../../util/fullyQualifiedClientIdUtils");
47
47
  const RecurringTaskScheduler_1 = require("../../../util/RecurringTaskScheduler");
48
48
  const TaskScheduler_1 = require("../../../util/TaskScheduler");
49
+ const TypedEventEmitter_1 = require("../../../util/TypedEventEmitter");
49
50
  const EventHandler_1 = require("../EventHandler");
50
51
  //@todo: this function is temporary, we wait for the update from core-crypto side
51
52
  //they are returning regular array instead of Uint8Array for commit and welcome messages
@@ -57,8 +58,9 @@ const defaultConfig = {
57
58
  keyingMaterialUpdateThreshold: 1000 * 60 * 60 * 24 * 30,
58
59
  nbKeyPackages: 100,
59
60
  };
60
- class MLSService {
61
+ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
61
62
  constructor(apiClient, coreCryptoClient, { keyingMaterialUpdateThreshold = defaultConfig.keyingMaterialUpdateThreshold, nbKeyPackages = defaultConfig.nbKeyPackages, }) {
63
+ super();
62
64
  this.apiClient = apiClient;
63
65
  this.coreCryptoClient = coreCryptoClient;
64
66
  this.logger = (0, logdown_1.default)('@wireapp/core/MLSService');
@@ -92,7 +94,7 @@ class MLSService {
92
94
  }
93
95
  const newEpoch = await this.getEpoch(groupId);
94
96
  const groupIdStr = bazinga64_1.Encoder.toBase64(groupId).asString;
95
- this.logger.log(`Commit have been accepted for group "${groupIdStr}". New epoch is "${newEpoch}"`);
97
+ this.emit('newEpoch', { epoch: newEpoch, groupId: groupIdStr });
96
98
  return response;
97
99
  }
98
100
  catch (error) {
@@ -381,7 +383,10 @@ class MLSService {
381
383
  return this.coreCryptoClient.wipeConversation(conversationId);
382
384
  }
383
385
  async handleEvent(params) {
384
- return (0, EventHandler_1.handleBackendEvent)(Object.assign(Object.assign({}, params), { mlsService: this }));
386
+ return (0, EventHandler_1.handleBackendEvent)(Object.assign(Object.assign({}, params), { mlsService: this }), async (groupId) => {
387
+ const newEpoch = await this.getEpoch(groupId);
388
+ this.emit('newEpoch', { groupId, epoch: newEpoch });
389
+ });
385
390
  }
386
391
  /**
387
392
  * If there is a matching conversationId => groupId pair in the database,
@@ -1,8 +1,6 @@
1
- /// <reference types="node" />
2
1
  import { BackendEvent } from '@wireapp/api-client/lib/event';
3
2
  import { Notification } from '@wireapp/api-client/lib/notification/';
4
3
  import { AbortHandler } from '@wireapp/api-client/lib/tcp';
5
- import { EventEmitter } from 'events';
6
4
  import { APIClient } from '@wireapp/api-client';
7
5
  import { GenericMessage } from '@wireapp/protocol-messaging';
8
6
  import { CRUDEngine } from '@wireapp/store-engine';
@@ -11,9 +9,13 @@ import { NotificationError } from '../CoreError';
11
9
  import { DecryptionError } from '../errors/DecryptionError';
12
10
  import { MLSService } from '../messagingProtocols/mls';
13
11
  import { ProteusService } from '../messagingProtocols/proteus';
12
+ import { TypedEventEmitter } from '../util/TypedEventEmitter';
14
13
  export type HandledEventPayload = {
14
+ /** the raw event received from backend */
15
15
  event: BackendEvent;
16
+ /** the decrypted data in case the event was an encrypted event */
16
17
  decryptedData?: GenericMessage;
18
+ /** in case decryption went wrong, this will contain information about the decryption error */
17
19
  decryptionError?: DecryptionError;
18
20
  };
19
21
  declare enum TOPIC {
@@ -23,10 +25,10 @@ export type NotificationHandler = (notification: Notification, source: Notificat
23
25
  done: number;
24
26
  total: number;
25
27
  }) => Promise<void>;
26
- export interface NotificationService {
27
- on(event: TOPIC.NOTIFICATION_ERROR, listener: (payload: NotificationError) => void): this;
28
- }
29
- export declare class NotificationService extends EventEmitter {
28
+ type Events = {
29
+ [TOPIC.NOTIFICATION_ERROR]: NotificationError;
30
+ };
31
+ export declare class NotificationService extends TypedEventEmitter<Events> {
30
32
  private readonly proteusService;
31
33
  private readonly mlsService?;
32
34
  private readonly apiClient;
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationService.d.ts","sourceRoot":"","sources":["../../src/notification/NotificationService.ts"],"names":[],"mappings":";AAmBA,OAAO,EAAC,YAAY,EAAqB,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAC,YAAY,EAAC,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAGzD,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,UAAU,EAA4B,MAAM,uBAAuB,CAAC;AAI5E,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAY,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAC,cAAc,EAAC,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mB,EAAE,mBAAmB,EACxC,qBAAqB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,EACvD,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAC;IAoC3D;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IAYT,kBAAkB,CAC9B,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,GAAE,OAAe,GACtB,cAAc,CAAC,mBAAmB,CAAC;IAmCtC;;;;;;OAMG;YACW,WAAW;CAmC1B"}
@@ -36,17 +36,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.NotificationService = void 0;
37
37
  const event_1 = require("@wireapp/api-client/lib/event");
38
38
  const logdown_1 = __importDefault(require("logdown"));
39
- const events_1 = require("events");
40
39
  const store_engine_1 = require("@wireapp/store-engine");
41
40
  const NotificationBackendRepository_1 = require("./NotificationBackendRepository");
42
41
  const NotificationDatabaseRepository_1 = require("./NotificationDatabaseRepository");
43
42
  const Notifications_types_1 = require("./Notifications.types");
44
43
  const CoreError_1 = require("../CoreError");
44
+ const TypedEventEmitter_1 = require("../util/TypedEventEmitter");
45
45
  var TOPIC;
46
46
  (function (TOPIC) {
47
47
  TOPIC["NOTIFICATION_ERROR"] = "NotificationService.TOPIC.NOTIFICATION_ERROR";
48
48
  })(TOPIC || (TOPIC = {}));
49
- class NotificationService extends events_1.EventEmitter {
49
+ class NotificationService extends TypedEventEmitter_1.TypedEventEmitter {
50
50
  constructor(apiClient, proteusService, storeEngine, mlsService) {
51
51
  super();
52
52
  this.proteusService = proteusService;
@@ -0,0 +1,9 @@
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ export declare class TypedEventEmitter<T extends Record<string | symbol, any>> extends EventEmitter {
4
+ emit<K extends keyof T>(eventName: K, ...args: T[K][]): boolean;
5
+ on<K extends keyof T>(eventName: K, listener: (...args: T[K][]) => void): this;
6
+ once<K extends keyof T>(eventName: K, listener: (...args: T[K][]) => void): this;
7
+ off<K extends keyof T>(eventName: K, listener: (...args: T[K][]) => void): this;
8
+ }
9
+ //# sourceMappingURL=TypedEventEmitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypedEventEmitter.d.ts","sourceRoot":"","sources":["../../src/util/TypedEventEmitter.ts"],"names":[],"mappings":";AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,qBAAa,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAE,SAAQ,YAAY;IACzF,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO;IAI/D,EAAE,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,GAAG,IAAI;IAI9E,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,GAAG,IAAI;IAIhF,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,GAAG,IAAI;CAGhF"}
@@ -0,0 +1,37 @@
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.TypedEventEmitter = void 0;
22
+ const events_1 = require("events");
23
+ class TypedEventEmitter extends events_1.EventEmitter {
24
+ emit(eventName, ...args) {
25
+ return super.emit(eventName, ...args);
26
+ }
27
+ on(eventName, listener) {
28
+ return super.on(eventName, listener);
29
+ }
30
+ once(eventName, listener) {
31
+ return super.once(eventName, listener);
32
+ }
33
+ off(eventName, listener) {
34
+ return super.off(eventName, listener);
35
+ }
36
+ }
37
+ exports.TypedEventEmitter = TypedEventEmitter;
package/package.json CHANGED
@@ -60,6 +60,6 @@
60
60
  "test:coverage": "jest --coverage",
61
61
  "watch": "tsc --watch"
62
62
  },
63
- "version": "38.6.0",
64
- "gitHead": "c9fb9bf799a0b71dbd55c51081080485cf8e5699"
63
+ "version": "38.7.0",
64
+ "gitHead": "fd1643d072f7e5b1a6552901b0a174831dbe227e"
65
65
  }
@@ -1,5 +0,0 @@
1
- import { EventHandlerParams } from '..';
2
- import { EventHandlerResult } from '../../../common.types';
3
- declare const handleConversationEvent: (params: EventHandlerParams) => EventHandlerResult;
4
- export { handleConversationEvent };
5
- //# sourceMappingURL=ConversationEvent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConversationEvent.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/EventHandler/ConversationEvent/ConversationEvent.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,IAAI,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AAIzD,QAAA,MAAM,uBAAuB,WAAkB,kBAAkB,uBAQhE,CAAC;AAEF,OAAO,EAAC,uBAAuB,EAAC,CAAC"}
@@ -1,37 +0,0 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
21
- return (mod && mod.__esModule) ? mod : { "default": mod };
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.handleConversationEvent = void 0;
25
- const logdown_1 = __importDefault(require("logdown"));
26
- const events_1 = require("./events");
27
- const logger = (0, logdown_1.default)('@wireapp/core/EventHandler/ConversationEvent');
28
- const handleConversationEvent = async (params) => {
29
- const { event } = params;
30
- if ((0, events_1.isWelcomeMessageEvent)(event)) {
31
- return (0, events_1.handleWelcomeMessage)(Object.assign(Object.assign({}, params), { event }));
32
- }
33
- if ((0, events_1.isMLSMessageAddEvent)(event)) {
34
- return (0, events_1.handleMLSMessageAdd)(Object.assign(Object.assign({}, params), { event, logger }));
35
- }
36
- };
37
- exports.handleConversationEvent = handleConversationEvent;
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/ConversationEvent/events/index.ts"],"names":[],"mappings":"AAmBA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/index.ts"],"names":[],"mappings":"AAmBA,cAAc,cAAc,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"messageAdd.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/messageAdd.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,8BAA8B,EAAqB,MAAM,+BAA+B,CAAC;AAE/G,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAE/D,QAAA,MAAM,oBAAoB,UAAW,YAAY,4CACE,CAAC;AAEpD,UAAU,yBAA0B,SAAQ,kBAAkB;IAC5D,KAAK,EAAE,8BAA8B,CAAC;IACtC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;CACxB;AACD,QAAA,MAAM,mBAAmB,kCAAuC,yBAAyB,uBA6CxF,CAAC;AAEF,OAAO,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"messageAdd.test.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/messageAdd.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/ConversationEvent/events/welcomeMessage/index.ts"],"names":[],"mappings":"AAmBA,cAAc,kBAAkB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"welcomeMessage.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/ConversationEvent/events/welcomeMessage/welcomeMessage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,2BAA2B,EAAqB,MAAM,+BAA+B,CAAC;AAG5G,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAE/D,QAAA,MAAM,qBAAqB,UAAW,YAAY,yCACK,CAAC;AAExD,UAAU,0BAA2B,SAAQ,kBAAkB;IAC7D,KAAK,EAAE,2BAA2B,CAAC;CACpC;AACD,QAAA,MAAM,oBAAoB,0BAA+B,0BAA0B,uBASlF,CAAC;AAEF,OAAO,EAAC,qBAAqB,EAAE,oBAAoB,EAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"welcomeMessage.test.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/ConversationEvent/events/welcomeMessage/welcomeMessage.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * from './ConversationEvent';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/EventHandler/ConversationEvent/index.ts"],"names":[],"mappings":"AAmBA,cAAc,qBAAqB,CAAC"}
@@ -1,35 +0,0 @@
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
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- var desc = Object.getOwnPropertyDescriptor(m, k);
23
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
- desc = { enumerable: true, get: function() { return m[k]; } };
25
- }
26
- Object.defineProperty(o, k2, desc);
27
- }) : (function(o, m, k, k2) {
28
- if (k2 === undefined) k2 = k;
29
- o[k2] = m[k];
30
- }));
31
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
32
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- __exportStar(require("./ConversationEvent"), exports);