@wireapp/api-client 27.0.8 → 27.0.10

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 (62) hide show
  1. package/lib/APIClient.d.ts +0 -1
  2. package/lib/APIClient.d.ts.map +1 -1
  3. package/lib/APIClient.js +24 -22
  4. package/lib/account/AccountAPI.js +16 -15
  5. package/lib/asset/AssetAPI.d.ts +0 -1
  6. package/lib/asset/AssetAPI.d.ts.map +1 -1
  7. package/lib/asset/AssetAPI.js +6 -5
  8. package/lib/auth/AccessTokenStore.d.ts +0 -1
  9. package/lib/auth/AccessTokenStore.d.ts.map +1 -1
  10. package/lib/auth/AccessTokenStore.js +8 -1
  11. package/lib/auth/AuthAPI.js +22 -27
  12. package/lib/auth/Cookie.js +2 -2
  13. package/lib/auth/CookieStore.d.ts +0 -1
  14. package/lib/auth/CookieStore.d.ts.map +1 -1
  15. package/lib/auth/CookieStore.js +3 -2
  16. package/lib/auth/parseAccessToken.js +3 -3
  17. package/lib/broadcast/BroadcastAPI.js +5 -4
  18. package/lib/client/ClientAPI.d.ts +1 -1
  19. package/lib/client/ClientAPI.js +11 -10
  20. package/lib/connection/ConnectionAPI.js +4 -3
  21. package/lib/conversation/ConversationAPI/ConversationAPI.js +34 -33
  22. package/lib/conversation/FederatedBackendsError.js +6 -5
  23. package/lib/demo/initClient.js +1 -2
  24. package/lib/generic/GenericAPI.js +1 -0
  25. package/lib/giphy/GiphyAPI.js +8 -7
  26. package/lib/http/BackendError.js +3 -0
  27. package/lib/http/HttpClient.d.ts +0 -1
  28. package/lib/http/HttpClient.d.ts.map +1 -1
  29. package/lib/http/HttpClient.js +49 -24
  30. package/lib/http/NetworkError.js +1 -0
  31. package/lib/notification/NotificationAPI/NotificationAPI.js +11 -11
  32. package/lib/notification/NotificationAPI/NotificationsAPI.mocks.d.ts +1 -1
  33. package/lib/oauth/OAuthAPI.js +8 -7
  34. package/lib/obfuscation/ObfuscationUtil.js +4 -1
  35. package/lib/self/SelfAPI.js +12 -11
  36. package/lib/serviceProvider/ServiceProviderAPI.js +8 -7
  37. package/lib/services/ServicesAPI.js +13 -11
  38. package/lib/shims/browser/cookie.d.ts.map +1 -1
  39. package/lib/shims/browser/websocket.d.ts +1 -1
  40. package/lib/shims/node/buffer.d.ts +0 -1
  41. package/lib/shims/node/buffer.d.ts.map +1 -1
  42. package/lib/shims/node/cookie.d.ts.map +1 -1
  43. package/lib/shims/node/cookie.js +1 -2
  44. package/lib/tcp/ReconnectingWebsocket.js +72 -64
  45. package/lib/tcp/WebSocketClient.d.ts +0 -1
  46. package/lib/tcp/WebSocketClient.d.ts.map +1 -1
  47. package/lib/tcp/WebSocketClient.js +68 -61
  48. package/lib/team/billing/BillingAPI.js +15 -14
  49. package/lib/team/conversation/TeamConversationAPI.js +6 -5
  50. package/lib/team/feature/FeatureAPI.js +20 -19
  51. package/lib/team/identityprovider/IdentityProviderAPI.js +6 -5
  52. package/lib/team/invitation/TeamInvitationAPI.js +9 -9
  53. package/lib/team/legalhold/LegalHoldAPI.js +6 -5
  54. package/lib/team/member/MemberAPI.js +8 -7
  55. package/lib/team/payment/PaymentAPI.js +12 -11
  56. package/lib/team/scim/ScimAPI.js +6 -5
  57. package/lib/team/search/TeamSearchAPI.js +9 -5
  58. package/lib/team/service/ServiceAPI.js +8 -7
  59. package/lib/team/team/TeamAPI.js +12 -8
  60. package/lib/user/UserAPI.js +40 -30
  61. package/lib/validation/ValidationError.js +1 -0
  62. package/package.json +3 -3
@@ -27,21 +27,28 @@ const http_1 = require("../../http");
27
27
  const user_1 = require("../../user");
28
28
  const team_1 = require("../team");
29
29
  class TeamSearchAPI {
30
+ client;
30
31
  constructor(client) {
31
32
  this.client = client;
32
33
  }
34
+ static URL = {
35
+ SEARCH: 'search',
36
+ };
33
37
  /**
34
38
  * Search for team members.
35
39
  * @param query The search query
36
40
  * @param options Search options (sort, order, filter, etc.)
37
41
  */
38
42
  async getSearchMembers(teamId, query, options = {}) {
39
- var _a;
40
43
  const cancelSource = axios_1.default.CancelToken.source();
41
44
  const config = {
42
45
  cancelToken: cancelSource.token,
43
46
  method: 'get',
44
- params: Object.assign(Object.assign({ q: query }, options), { frole: (_a = options.frole) === null || _a === void 0 ? void 0 : _a.join(',') }),
47
+ params: {
48
+ q: query,
49
+ ...options,
50
+ frole: options.frole?.join(','),
51
+ },
45
52
  url: `${team_1.TeamAPI.URL.TEAMS}/${teamId}/${TeamSearchAPI.URL.SEARCH}`,
46
53
  };
47
54
  const handleRequest = async () => {
@@ -63,6 +70,3 @@ class TeamSearchAPI {
63
70
  }
64
71
  }
65
72
  exports.TeamSearchAPI = TeamSearchAPI;
66
- TeamSearchAPI.URL = {
67
- SEARCH: 'search',
68
- };
@@ -20,9 +20,17 @@
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.ServiceAPI = void 0;
22
22
  class ServiceAPI {
23
+ client;
23
24
  constructor(client) {
24
25
  this.client = client;
25
26
  }
27
+ static URL = {
28
+ PROVIDERS: '/providers',
29
+ SERVICES: 'services',
30
+ TEAMS: '/teams',
31
+ WHITELIST: 'whitelist',
32
+ WHITELISTED: 'whitelisted',
33
+ };
26
34
  async getServices(limit = 100, start, tags) {
27
35
  const config = {
28
36
  method: 'get',
@@ -84,10 +92,3 @@ class ServiceAPI {
84
92
  }
85
93
  }
86
94
  exports.ServiceAPI = ServiceAPI;
87
- ServiceAPI.URL = {
88
- PROVIDERS: '/providers',
89
- SERVICES: 'services',
90
- TEAMS: '/teams',
91
- WHITELIST: 'whitelist',
92
- WHITELISTED: 'whitelisted',
93
- };
@@ -26,9 +26,17 @@ const axios_1 = __importDefault(require("axios"));
26
26
  const http_1 = require("../../http/");
27
27
  const user_1 = require("../../user");
28
28
  class TeamAPI {
29
+ client;
29
30
  constructor(client) {
30
31
  this.client = client;
31
32
  }
33
+ static URL = {
34
+ SIZE: 'size',
35
+ TEAMS: '/teams',
36
+ CONSENT: '/consent',
37
+ MARKETO: 'marketo',
38
+ LEAD: 'lead',
39
+ };
32
40
  async postTeam(team) {
33
41
  const config = {
34
42
  data: team,
@@ -65,7 +73,10 @@ class TeamAPI {
65
73
  }
66
74
  async deleteTeam(teamId, password, verificationCode) {
67
75
  const config = {
68
- data: Object.assign({ password }, (verificationCode && { verification_code: verificationCode })),
76
+ data: {
77
+ password,
78
+ ...(verificationCode && { verification_code: verificationCode }),
79
+ },
69
80
  method: 'delete',
70
81
  url: `${TeamAPI.URL.TEAMS}/${teamId}`,
71
82
  };
@@ -115,10 +126,3 @@ class TeamAPI {
115
126
  }
116
127
  }
117
128
  exports.TeamAPI = TeamAPI;
118
- TeamAPI.URL = {
119
- SIZE: 'size',
120
- TEAMS: '/teams',
121
- CONSENT: '/consent',
122
- MARKETO: 'marketo',
123
- LEAD: 'lead',
124
- };
@@ -33,6 +33,34 @@ function isUsersResponse(object) {
33
33
  return object.found || object.failed || object.not_found;
34
34
  }
35
35
  class UserAPI {
36
+ client;
37
+ backendFeatures;
38
+ static DEFAULT_USERS_CHUNK_SIZE = 50;
39
+ static DEFAULT_USERS_PREKEY_BUNDLE_CHUNK_SIZE = 128;
40
+ static URL = {
41
+ ACTIVATE: '/activate',
42
+ BY_HANDLE: 'by-handle',
43
+ CALLS: '/calls',
44
+ CLIENTS: 'clients',
45
+ CONFIG: 'config',
46
+ CONTACTS: 'contacts',
47
+ DELETE: '/delete',
48
+ EMAIL: 'email',
49
+ HANDLES: 'handles',
50
+ LIST_CLIENTS: 'list-clients',
51
+ LIST_PREKEYS: 'list-prekeys',
52
+ LIST_USERS: '/list-users',
53
+ PASSWORD_RESET: '/password-reset',
54
+ PRE_KEYS: 'prekeys',
55
+ PROPERTIES: '/properties',
56
+ RICH_INFO: 'rich-info',
57
+ SEARCH: '/search',
58
+ SEND: 'send',
59
+ USERS: '/users',
60
+ V2: 'v2',
61
+ VERIFICATION: '/verification-code',
62
+ SUPPORTED_PROTOCOLS: 'supported-protocols',
63
+ };
36
64
  constructor(client, backendFeatures) {
37
65
  this.client = client;
38
66
  this.backendFeatures = backendFeatures;
@@ -485,17 +513,25 @@ class UserAPI {
485
513
  const chunksPromises = commons_1.ArrayUtil.chunk(flattenUsers, limit)
486
514
  .map(chunk => {
487
515
  return chunk.reduce((chunkedMap, { userId, clients }) => {
488
- return Object.assign(Object.assign({}, chunkedMap), { [userId.domain]: Object.assign(Object.assign({}, chunkedMap[userId.domain]), { [userId.id]: clients }) });
516
+ return {
517
+ ...chunkedMap,
518
+ [userId.domain]: {
519
+ ...chunkedMap[userId.domain],
520
+ [userId.id]: clients,
521
+ },
522
+ };
489
523
  }, {});
490
524
  })
491
525
  .map(chunkedMap => this.postMultiPreKeyBundlesChunk(chunkedMap));
492
526
  const userPreKeyBundleMapChunks = await Promise.all(chunksPromises);
493
527
  return userPreKeyBundleMapChunks.reduce((response, userPreKeyBundleMapChunk) => {
494
- var _a, _b;
495
528
  Object.entries(userPreKeyBundleMapChunk.qualified_user_client_prekeys).forEach(([domain, userClientMap]) => {
496
- response.qualified_user_client_prekeys[domain] = Object.assign(Object.assign({}, response.qualified_user_client_prekeys[domain]), userClientMap);
529
+ response.qualified_user_client_prekeys[domain] = {
530
+ ...response.qualified_user_client_prekeys[domain],
531
+ ...userClientMap,
532
+ };
497
533
  });
498
- (_a = response.failed_to_list) === null || _a === void 0 ? void 0 : _a.push(...((_b = userPreKeyBundleMapChunk.failed_to_list) !== null && _b !== void 0 ? _b : []));
534
+ response.failed_to_list?.push(...(userPreKeyBundleMapChunk.failed_to_list ?? []));
499
535
  return response;
500
536
  }, { qualified_user_client_prekeys: {}, failed_to_list: [] });
501
537
  }
@@ -555,29 +591,3 @@ class UserAPI {
555
591
  }
556
592
  }
557
593
  exports.UserAPI = UserAPI;
558
- UserAPI.DEFAULT_USERS_CHUNK_SIZE = 50;
559
- UserAPI.DEFAULT_USERS_PREKEY_BUNDLE_CHUNK_SIZE = 128;
560
- UserAPI.URL = {
561
- ACTIVATE: '/activate',
562
- BY_HANDLE: 'by-handle',
563
- CALLS: '/calls',
564
- CLIENTS: 'clients',
565
- CONFIG: 'config',
566
- CONTACTS: 'contacts',
567
- DELETE: '/delete',
568
- EMAIL: 'email',
569
- HANDLES: 'handles',
570
- LIST_CLIENTS: 'list-clients',
571
- LIST_PREKEYS: 'list-prekeys',
572
- LIST_USERS: '/list-users',
573
- PASSWORD_RESET: '/password-reset',
574
- PRE_KEYS: 'prekeys',
575
- PROPERTIES: '/properties',
576
- RICH_INFO: 'rich-info',
577
- SEARCH: '/search',
578
- SEND: 'send',
579
- USERS: '/users',
580
- V2: 'v2',
581
- VERIFICATION: '/verification-code',
582
- SUPPORTED_PROTOCOLS: 'supported-protocols',
583
- };
@@ -20,6 +20,7 @@
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.ValidationError = void 0;
22
22
  class ValidationError extends Error {
23
+ message;
23
24
  constructor(message) {
24
25
  super(message);
25
26
  this.message = message;
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "@wireapp/priority-queue": "^2.1.6",
18
18
  "@wireapp/protocol-messaging": "1.48.0",
19
19
  "axios": "1.7.2",
20
- "axios-retry": "4.4.0",
20
+ "axios-retry": "4.4.1",
21
21
  "http-status-codes": "2.3.0",
22
22
  "logdown": "3.3.1",
23
23
  "pako": "2.1.0",
@@ -66,6 +66,6 @@
66
66
  "watch": "webpack serve --config webpack.browser.js",
67
67
  "prepare": "yarn dist"
68
68
  },
69
- "version": "27.0.8",
70
- "gitHead": "e157610152d7952cb2bdb134c40a7658c012d1a3"
69
+ "version": "27.0.10",
70
+ "gitHead": "66832e5bcf50be7819022bfdd5e608204c6e7f06"
71
71
  }