@wireapp/api-client 27.0.13 → 27.1.0-hotfix-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/lib/APIClient.d.ts +1 -0
- package/lib/APIClient.d.ts.map +1 -1
- package/lib/APIClient.js +22 -24
- package/lib/account/AccountAPI.js +15 -16
- package/lib/asset/AssetAPI.d.ts +1 -0
- package/lib/asset/AssetAPI.d.ts.map +1 -1
- package/lib/asset/AssetAPI.js +4 -5
- package/lib/auth/AccessTokenStore.d.ts +1 -0
- package/lib/auth/AccessTokenStore.d.ts.map +1 -1
- package/lib/auth/AccessTokenStore.js +1 -8
- package/lib/auth/AuthAPI.js +27 -22
- package/lib/auth/Cookie.js +2 -2
- package/lib/auth/CookieStore.d.ts +1 -0
- package/lib/auth/CookieStore.d.ts.map +1 -1
- package/lib/auth/CookieStore.js +2 -3
- package/lib/auth/parseAccessToken.js +3 -3
- package/lib/broadcast/BroadcastAPI.js +4 -5
- package/lib/client/ClientAPI.d.ts +10 -10
- package/lib/client/ClientAPI.d.ts.map +1 -1
- package/lib/client/ClientAPI.js +14 -12
- package/lib/connection/ConnectionAPI.js +3 -4
- package/lib/conversation/Conversation.d.ts +8 -0
- package/lib/conversation/Conversation.d.ts.map +1 -1
- package/lib/conversation/Conversation.js +8 -1
- package/lib/conversation/ConversationAPI/ConversationAPI.d.ts +2 -2
- package/lib/conversation/ConversationAPI/ConversationAPI.d.ts.map +1 -1
- package/lib/conversation/ConversationAPI/ConversationAPI.js +33 -34
- package/lib/conversation/FederatedBackendsError.js +5 -6
- package/lib/demo/initClient.js +2 -1
- package/lib/generic/GenericAPI.js +0 -1
- package/lib/giphy/GiphyAPI.js +7 -8
- package/lib/http/BackendError.js +0 -3
- package/lib/http/HttpClient.d.ts +1 -0
- package/lib/http/HttpClient.d.ts.map +1 -1
- package/lib/http/HttpClient.js +24 -49
- package/lib/http/NetworkError.js +0 -1
- package/lib/notification/NotificationAPI/NotificationAPI.js +11 -11
- package/lib/notification/NotificationAPI/NotificationsAPI.mocks.d.ts +1 -1
- package/lib/oauth/OAuthAPI.js +7 -8
- package/lib/obfuscation/ObfuscationUtil.js +1 -4
- package/lib/self/SelfAPI.js +11 -12
- package/lib/serviceProvider/ServiceProviderAPI.js +7 -8
- package/lib/services/ServicesAPI.js +11 -13
- package/lib/shims/browser/cookie.d.ts.map +1 -1
- package/lib/shims/browser/websocket.d.ts +1 -1
- package/lib/shims/node/buffer.d.ts +1 -0
- package/lib/shims/node/buffer.d.ts.map +1 -1
- package/lib/shims/node/cookie.d.ts.map +1 -1
- package/lib/shims/node/cookie.js +2 -1
- package/lib/tcp/ReconnectingWebsocket.js +64 -72
- package/lib/tcp/WebSocketClient.d.ts +1 -0
- package/lib/tcp/WebSocketClient.d.ts.map +1 -1
- package/lib/tcp/WebSocketClient.js +61 -68
- package/lib/team/billing/BillingAPI.js +14 -15
- package/lib/team/conversation/TeamConversationAPI.js +5 -6
- package/lib/team/feature/Feature.d.ts +4 -1
- package/lib/team/feature/Feature.d.ts.map +1 -1
- package/lib/team/feature/FeatureAPI.js +19 -20
- package/lib/team/identityprovider/IdentityProviderAPI.js +5 -6
- package/lib/team/invitation/TeamInvitationAPI.js +9 -9
- package/lib/team/legalhold/LegalHoldAPI.js +5 -6
- package/lib/team/member/MemberAPI.js +7 -8
- package/lib/team/payment/PaymentAPI.js +11 -12
- package/lib/team/scim/ScimAPI.js +5 -6
- package/lib/team/search/TeamSearchAPI.js +5 -9
- package/lib/team/service/ServiceAPI.js +7 -8
- package/lib/team/team/TeamAPI.js +8 -12
- package/lib/user/UserAPI.js +30 -40
- package/lib/validation/ValidationError.js +0 -1
- package/package.json +12 -12
- package/LICENSE +0 -674
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationAPI.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationAPI/ConversationAPI.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,OAAO,IAAI,WAAW,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;;;OAMG;IACU,cAAc,CACzB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,iCAAiC,GAClD,OAAO,CAAC,IAAI,CAAC;IAUhB;;;;;OAKG;IACU,uBAAuB,CAClC,cAAc,EAAE,WAAW,EAC3B,UAAU,EAAE,OAAO,CAAC,4BAA4B,CAAC,GAChD,OAAO,CAAC,IAAI,CAAC;IAUhB;;;;;;;;;OASG;IACU,uBAAuB,CAClC,cAAc,EAAE,WAAW,EAC3B,QAAQ,EAAE,oBAAoB,CAAC,KAAK,GAAG,oBAAoB,CAAC,GAAG,GAC9D,OAAO,CAAC,+BAA+B,GAAG,IAAI,CAAC;CAgBnD"}
|
|
@@ -27,37 +27,6 @@ const http_1 = require("../../http");
|
|
|
27
27
|
const ConversationError_1 = require("../ConversationError");
|
|
28
28
|
const FederatedBackendsError_1 = require("../FederatedBackendsError");
|
|
29
29
|
class ConversationAPI {
|
|
30
|
-
client;
|
|
31
|
-
backendFeatures;
|
|
32
|
-
static MAX_CHUNK_SIZE = 500;
|
|
33
|
-
static URL = {
|
|
34
|
-
ACCESS: 'access',
|
|
35
|
-
BOTS: 'bots',
|
|
36
|
-
CLIENTS: '/clients',
|
|
37
|
-
CODE: 'code',
|
|
38
|
-
CODE_CHECK: '/code-check',
|
|
39
|
-
CONVERSATIONS: '/conversations',
|
|
40
|
-
SUBCONVERSATIONS: 'subconversations',
|
|
41
|
-
GROUP_INFO: 'groupinfo',
|
|
42
|
-
MLS: '/mls',
|
|
43
|
-
JOIN: '/join',
|
|
44
|
-
LIST: 'list',
|
|
45
|
-
LIST_IDS: 'list-ids',
|
|
46
|
-
MEMBERS: 'members',
|
|
47
|
-
MESSAGE_TIMER: 'message-timer',
|
|
48
|
-
MESSAGES: 'messages',
|
|
49
|
-
NAME: 'name',
|
|
50
|
-
OTR: 'otr',
|
|
51
|
-
PROTEUS: 'proteus',
|
|
52
|
-
PROTOCOL: 'protocol',
|
|
53
|
-
RECEIPT_MODE: 'receipt-mode',
|
|
54
|
-
ROLES: 'roles',
|
|
55
|
-
SELF: 'self',
|
|
56
|
-
MLS_SELF: 'mls-self',
|
|
57
|
-
TYPING: 'typing',
|
|
58
|
-
V2: 'v2',
|
|
59
|
-
ONE_2_ONE: 'one2one',
|
|
60
|
-
};
|
|
61
30
|
constructor(client, backendFeatures) {
|
|
62
31
|
this.client = client;
|
|
63
32
|
this.backendFeatures = backendFeatures;
|
|
@@ -227,6 +196,7 @@ class ConversationAPI {
|
|
|
227
196
|
* @see https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_conversations_list_v2
|
|
228
197
|
*/
|
|
229
198
|
async getConversationsByQualifiedIds(conversations) {
|
|
199
|
+
var _a, _b, _c, _d, _e, _f;
|
|
230
200
|
const chunks = (0, ArrayUtil_1.chunk)(conversations, ConversationAPI.MAX_CHUNK_SIZE);
|
|
231
201
|
let results = { found: [], failed: [], not_found: [] };
|
|
232
202
|
for (const chunk of chunks) {
|
|
@@ -239,9 +209,9 @@ class ConversationAPI {
|
|
|
239
209
|
};
|
|
240
210
|
const { data } = await this.client.sendJSON(config);
|
|
241
211
|
results = {
|
|
242
|
-
found: results.found
|
|
243
|
-
not_found: results.not_found
|
|
244
|
-
failed: results.failed
|
|
212
|
+
found: (_a = results.found) === null || _a === void 0 ? void 0 : _a.concat((_b = data.found) !== null && _b !== void 0 ? _b : []),
|
|
213
|
+
not_found: (_c = results.not_found) === null || _c === void 0 ? void 0 : _c.concat((_d = data.not_found) !== null && _d !== void 0 ? _d : []),
|
|
214
|
+
failed: (_e = results.failed) === null || _e === void 0 ? void 0 : _e.concat((_f = data.failed) !== null && _f !== void 0 ? _f : []),
|
|
245
215
|
};
|
|
246
216
|
}
|
|
247
217
|
return results;
|
|
@@ -742,3 +712,32 @@ class ConversationAPI {
|
|
|
742
712
|
}
|
|
743
713
|
}
|
|
744
714
|
exports.ConversationAPI = ConversationAPI;
|
|
715
|
+
ConversationAPI.MAX_CHUNK_SIZE = 500;
|
|
716
|
+
ConversationAPI.URL = {
|
|
717
|
+
ACCESS: 'access',
|
|
718
|
+
BOTS: 'bots',
|
|
719
|
+
CLIENTS: '/clients',
|
|
720
|
+
CODE: 'code',
|
|
721
|
+
CODE_CHECK: '/code-check',
|
|
722
|
+
CONVERSATIONS: '/conversations',
|
|
723
|
+
SUBCONVERSATIONS: 'subconversations',
|
|
724
|
+
GROUP_INFO: 'groupinfo',
|
|
725
|
+
MLS: '/mls',
|
|
726
|
+
JOIN: '/join',
|
|
727
|
+
LIST: 'list',
|
|
728
|
+
LIST_IDS: 'list-ids',
|
|
729
|
+
MEMBERS: 'members',
|
|
730
|
+
MESSAGE_TIMER: 'message-timer',
|
|
731
|
+
MESSAGES: 'messages',
|
|
732
|
+
NAME: 'name',
|
|
733
|
+
OTR: 'otr',
|
|
734
|
+
PROTEUS: 'proteus',
|
|
735
|
+
PROTOCOL: 'protocol',
|
|
736
|
+
RECEIPT_MODE: 'receipt-mode',
|
|
737
|
+
ROLES: 'roles',
|
|
738
|
+
SELF: 'self',
|
|
739
|
+
MLS_SELF: 'mls-self',
|
|
740
|
+
TYPING: 'typing',
|
|
741
|
+
V2: 'v2',
|
|
742
|
+
ONE_2_ONE: 'one2one',
|
|
743
|
+
};
|
|
@@ -18,9 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.FederatedBackendsError = exports.FederatedBackendsErrorLabel = void 0;
|
|
22
|
-
exports.isFederatedBackendsError = isFederatedBackendsError;
|
|
23
|
-
exports.handleFederationErrors = handleFederationErrors;
|
|
21
|
+
exports.handleFederationErrors = exports.isFederatedBackendsError = exports.FederatedBackendsError = exports.FederatedBackendsErrorLabel = void 0;
|
|
24
22
|
var FederatedBackendsErrorLabel;
|
|
25
23
|
(function (FederatedBackendsErrorLabel) {
|
|
26
24
|
FederatedBackendsErrorLabel["UNREACHABLE_BACKENDS"] = "UnreachableBackendsError";
|
|
@@ -32,8 +30,6 @@ var FederatedBackendsErrorCode;
|
|
|
32
30
|
FederatedBackendsErrorCode[FederatedBackendsErrorCode["UNREACHABLE"] = 533] = "UNREACHABLE";
|
|
33
31
|
})(FederatedBackendsErrorCode || (FederatedBackendsErrorCode = {}));
|
|
34
32
|
class FederatedBackendsError extends Error {
|
|
35
|
-
label;
|
|
36
|
-
backends;
|
|
37
33
|
constructor(label, backends) {
|
|
38
34
|
super('federatedBackendsError');
|
|
39
35
|
this.label = label;
|
|
@@ -45,8 +41,10 @@ exports.FederatedBackendsError = FederatedBackendsError;
|
|
|
45
41
|
function isFederatedBackendsError(error) {
|
|
46
42
|
return !!error && typeof error === 'object' && 'name' in error && error.name === 'FederatedBackendsError';
|
|
47
43
|
}
|
|
44
|
+
exports.isFederatedBackendsError = isFederatedBackendsError;
|
|
48
45
|
function handleFederationErrors(error) {
|
|
49
|
-
|
|
46
|
+
var _a;
|
|
47
|
+
switch ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) {
|
|
50
48
|
case FederatedBackendsErrorCode.UNREACHABLE: {
|
|
51
49
|
throw new FederatedBackendsError(FederatedBackendsErrorLabel.UNREACHABLE_BACKENDS, error.response.data.unreachable_backends);
|
|
52
50
|
}
|
|
@@ -55,3 +53,4 @@ function handleFederationErrors(error) {
|
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
55
|
}
|
|
56
|
+
exports.handleFederationErrors = handleFederationErrors;
|
package/lib/demo/initClient.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.initClient =
|
|
21
|
+
exports.initClient = void 0;
|
|
22
22
|
const APIClient_1 = require("../APIClient");
|
|
23
23
|
const client_1 = require("../client");
|
|
24
24
|
require('dotenv').config();
|
|
@@ -39,3 +39,4 @@ async function initClient() {
|
|
|
39
39
|
await apiClient.login(credentials);
|
|
40
40
|
return apiClient;
|
|
41
41
|
}
|
|
42
|
+
exports.initClient = initClient;
|
package/lib/giphy/GiphyAPI.js
CHANGED
|
@@ -20,17 +20,9 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.GiphyAPI = void 0;
|
|
22
22
|
class GiphyAPI {
|
|
23
|
-
client;
|
|
24
23
|
constructor(client) {
|
|
25
24
|
this.client = client;
|
|
26
25
|
}
|
|
27
|
-
static URL = {
|
|
28
|
-
GIPHY: 'giphy/v1/gifs',
|
|
29
|
-
PROXY: '/proxy',
|
|
30
|
-
RANDOM: 'random',
|
|
31
|
-
SEARCH: 'search',
|
|
32
|
-
TRENDING: 'trending',
|
|
33
|
-
};
|
|
34
26
|
/**
|
|
35
27
|
* Get multiple Giphy images by IDs.
|
|
36
28
|
* @see https://developers.giphy.com/docs/api/endpoint#get-gifs-by-id
|
|
@@ -99,3 +91,10 @@ class GiphyAPI {
|
|
|
99
91
|
}
|
|
100
92
|
}
|
|
101
93
|
exports.GiphyAPI = GiphyAPI;
|
|
94
|
+
GiphyAPI.URL = {
|
|
95
|
+
GIPHY: 'giphy/v1/gifs',
|
|
96
|
+
PROXY: '/proxy',
|
|
97
|
+
RANDOM: 'random',
|
|
98
|
+
SEARCH: 'search',
|
|
99
|
+
TRENDING: 'trending',
|
|
100
|
+
};
|
package/lib/http/BackendError.js
CHANGED
|
@@ -21,9 +21,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.BackendError = void 0;
|
|
22
22
|
const BackendErrorLabel_1 = require("./BackendErrorLabel");
|
|
23
23
|
class BackendError extends Error {
|
|
24
|
-
code;
|
|
25
|
-
label;
|
|
26
|
-
message;
|
|
27
24
|
constructor(message, label = BackendErrorLabel_1.SyntheticErrorLabel.UNKNOWN, code) {
|
|
28
25
|
super(message);
|
|
29
26
|
this.code = code;
|
package/lib/http/HttpClient.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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C,EACzB,MAAM,EAAE,kBAAkB,EAC1B,oBAAoB,GAAE,OAAe,GACpC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAQrB,eAAe,CAAC,CAAC,EACtB,MAAM,EAAE,kBAAkB,EAC1B,oBAAoB,GAAE,OAAe,GACpC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CAO7B"}
|
package/lib/http/HttpClient.js
CHANGED
|
@@ -63,19 +63,11 @@ var TOPIC;
|
|
|
63
63
|
})(TOPIC || (TOPIC = {}));
|
|
64
64
|
const FILE_SIZE_100_MB = 104857600;
|
|
65
65
|
class HttpClient extends events_1.EventEmitter {
|
|
66
|
-
config;
|
|
67
|
-
accessTokenStore;
|
|
68
|
-
client;
|
|
69
|
-
logger;
|
|
70
|
-
connectionState;
|
|
71
|
-
requestQueue;
|
|
72
|
-
backOffQueue;
|
|
73
|
-
static TOPIC = TOPIC;
|
|
74
|
-
versionPrefix = '';
|
|
75
66
|
constructor(config, accessTokenStore) {
|
|
76
67
|
super();
|
|
77
68
|
this.config = config;
|
|
78
69
|
this.accessTokenStore = accessTokenStore;
|
|
70
|
+
this.versionPrefix = '';
|
|
79
71
|
this.client = axios_1.default.create({
|
|
80
72
|
baseURL: this.config.urls.rest,
|
|
81
73
|
});
|
|
@@ -90,7 +82,7 @@ class HttpClient extends events_1.EventEmitter {
|
|
|
90
82
|
this.updateConnectionState(http_1.ConnectionState.DISCONNECTED);
|
|
91
83
|
return true;
|
|
92
84
|
}
|
|
93
|
-
if (response
|
|
85
|
+
if ((response === null || response === void 0 ? void 0 : response.status) !== 401 && (response === null || response === void 0 ? void 0 : response.status) !== 403) {
|
|
94
86
|
// we only want to retry auth failures (access token will automatically be regenerated)
|
|
95
87
|
return false;
|
|
96
88
|
}
|
|
@@ -112,7 +104,8 @@ class HttpClient extends events_1.EventEmitter {
|
|
|
112
104
|
retryDelay: 200,
|
|
113
105
|
maxRetryDelay: 2000,
|
|
114
106
|
shouldRetry: error => {
|
|
115
|
-
|
|
107
|
+
var _a;
|
|
108
|
+
const isTooManyRequestsError = axios_1.default.isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 420;
|
|
116
109
|
return isTooManyRequestsError;
|
|
117
110
|
},
|
|
118
111
|
});
|
|
@@ -130,29 +123,20 @@ class HttpClient extends events_1.EventEmitter {
|
|
|
130
123
|
}
|
|
131
124
|
}
|
|
132
125
|
async _sendRequest(config, tokenAsParam = false, isFirstTry = true) {
|
|
126
|
+
var _a, _b;
|
|
133
127
|
if (this.accessTokenStore.accessToken) {
|
|
134
128
|
const { token_type, access_token } = this.accessTokenStore.accessToken;
|
|
135
129
|
if (tokenAsParam) {
|
|
136
|
-
config.params = {
|
|
137
|
-
...config.params,
|
|
138
|
-
access_token,
|
|
139
|
-
};
|
|
130
|
+
config.params = Object.assign(Object.assign({}, config.params), { access_token });
|
|
140
131
|
}
|
|
141
132
|
else {
|
|
142
|
-
config.headers = {
|
|
143
|
-
...config.headers,
|
|
144
|
-
Authorization: `${token_type} ${access_token}`,
|
|
145
|
-
};
|
|
133
|
+
config.headers = Object.assign(Object.assign({}, config.headers), { Authorization: `${token_type} ${access_token}` });
|
|
146
134
|
}
|
|
147
135
|
}
|
|
148
136
|
try {
|
|
149
|
-
const response = await this.client.request({
|
|
150
|
-
...config,
|
|
137
|
+
const response = await this.client.request(Object.assign(Object.assign({}, config), {
|
|
151
138
|
// We want to prefix all urls, except the ones with cookies which are attached to unprefixed urls
|
|
152
|
-
url: config.withCredentials ? config.url : `${this.versionPrefix}${config.url}`,
|
|
153
|
-
maxBodyLength: FILE_SIZE_100_MB,
|
|
154
|
-
maxContentLength: FILE_SIZE_100_MB,
|
|
155
|
-
});
|
|
139
|
+
url: config.withCredentials ? config.url : `${this.versionPrefix}${config.url}`, maxBodyLength: FILE_SIZE_100_MB, maxContentLength: FILE_SIZE_100_MB }));
|
|
156
140
|
this.updateConnectionState(http_1.ConnectionState.CONNECTED);
|
|
157
141
|
return response;
|
|
158
142
|
}
|
|
@@ -165,8 +149,8 @@ class HttpClient extends events_1.EventEmitter {
|
|
|
165
149
|
};
|
|
166
150
|
return this._sendRequest(config, tokenAsParam, false);
|
|
167
151
|
};
|
|
168
|
-
const hasAccessToken = !!this.accessTokenStore
|
|
169
|
-
if (axios_1.default.isAxiosError(error) && error.response
|
|
152
|
+
const hasAccessToken = !!((_a = this.accessTokenStore) === null || _a === void 0 ? void 0 : _a.accessToken);
|
|
153
|
+
if (axios_1.default.isAxiosError(error) && ((_b = error.response) === null || _b === void 0 ? void 0 : _b.status) === http_1.StatusCode.UNAUTHORIZED) {
|
|
170
154
|
return retryWithTokenRefresh();
|
|
171
155
|
}
|
|
172
156
|
if (HttpClient.isBackendError(error)) {
|
|
@@ -192,7 +176,7 @@ class HttpClient extends events_1.EventEmitter {
|
|
|
192
176
|
static isBackendError(errorCandidate) {
|
|
193
177
|
if (errorCandidate.response) {
|
|
194
178
|
const { data } = errorCandidate.response;
|
|
195
|
-
return !!data
|
|
179
|
+
return !!(data === null || data === void 0 ? void 0 : data.code) && !!(data === null || data === void 0 ? void 0 : data.label) && !!(data === null || data === void 0 ? void 0 : data.message);
|
|
196
180
|
}
|
|
197
181
|
return false;
|
|
198
182
|
}
|
|
@@ -210,8 +194,9 @@ class HttpClient extends events_1.EventEmitter {
|
|
|
210
194
|
return false;
|
|
211
195
|
}
|
|
212
196
|
async refreshAccessToken() {
|
|
197
|
+
var _a;
|
|
213
198
|
let expiredAccessToken;
|
|
214
|
-
if (this.accessTokenStore.accessToken
|
|
199
|
+
if ((_a = this.accessTokenStore.accessToken) === null || _a === void 0 ? void 0 : _a.access_token) {
|
|
215
200
|
expiredAccessToken = this.accessTokenStore.accessToken;
|
|
216
201
|
}
|
|
217
202
|
const accessToken = await this.postAccess(expiredAccessToken);
|
|
@@ -226,7 +211,7 @@ class HttpClient extends events_1.EventEmitter {
|
|
|
226
211
|
withCredentials: true,
|
|
227
212
|
params: clientId && { client_id: clientId },
|
|
228
213
|
};
|
|
229
|
-
if (expiredAccessToken
|
|
214
|
+
if ((expiredAccessToken === null || expiredAccessToken === void 0 ? void 0 : expiredAccessToken.access_token) && (config === null || config === void 0 ? void 0 : config.headers)) {
|
|
230
215
|
config.headers = new axios_1.AxiosHeaders(config.headers);
|
|
231
216
|
config.headers.set('Authorization', `${expiredAccessToken.token_type} ${decodeURIComponent(expiredAccessToken.access_token)}`);
|
|
232
217
|
}
|
|
@@ -244,6 +229,7 @@ class HttpClient extends events_1.EventEmitter {
|
|
|
244
229
|
return this.accessTokenStore.updateToken(newToken);
|
|
245
230
|
}
|
|
246
231
|
async sendRequest(config, tokenAsParam = false, isSynchronousRequest = false) {
|
|
232
|
+
var _a;
|
|
247
233
|
const promise = isSynchronousRequest
|
|
248
234
|
? this.requestQueue.add(() => this._sendRequest(config, tokenAsParam))
|
|
249
235
|
: this._sendRequest(config, tokenAsParam);
|
|
@@ -253,7 +239,7 @@ class HttpClient extends events_1.EventEmitter {
|
|
|
253
239
|
catch (error) {
|
|
254
240
|
// If the request failed due to too many requests, we want put it into the backoff queue
|
|
255
241
|
// It will be retried after a (growing) delay
|
|
256
|
-
const isTooManyRequestsError = axios_1.default.isAxiosError(error) && error.response
|
|
242
|
+
const isTooManyRequestsError = axios_1.default.isAxiosError(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 420;
|
|
257
243
|
if (isTooManyRequestsError) {
|
|
258
244
|
return this.backOffQueue.add(() => this._sendRequest(config, tokenAsParam));
|
|
259
245
|
}
|
|
@@ -261,39 +247,28 @@ class HttpClient extends events_1.EventEmitter {
|
|
|
261
247
|
}
|
|
262
248
|
}
|
|
263
249
|
sendJSON(config, isSynchronousRequest = false) {
|
|
250
|
+
var _a, _b, _c;
|
|
264
251
|
const shouldGzipData = process.env.NODE_ENV !== 'test' &&
|
|
265
252
|
!!config.data &&
|
|
266
|
-
['post', 'put', 'patch'].includes(config.method
|
|
253
|
+
['post', 'put', 'patch'].includes((_b = (_a = config.method) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '');
|
|
267
254
|
if (shouldGzipData) {
|
|
268
255
|
config.data = (0, pako_1.gzip)(JSON.stringify(config.data));
|
|
269
256
|
}
|
|
270
|
-
config.headers = {
|
|
271
|
-
...config.headers,
|
|
272
|
-
'Content-Type': http_1.ContentType.APPLICATION_JSON,
|
|
273
|
-
'Content-Encoding': shouldGzipData ? 'gzip' : config.headers?.['Content-Encoding'],
|
|
274
|
-
};
|
|
257
|
+
config.headers = Object.assign(Object.assign({}, config.headers), { 'Content-Type': http_1.ContentType.APPLICATION_JSON, 'Content-Encoding': shouldGzipData ? 'gzip' : (_c = config.headers) === null || _c === void 0 ? void 0 : _c['Content-Encoding'] });
|
|
275
258
|
return this.sendRequest(config, false, isSynchronousRequest);
|
|
276
259
|
}
|
|
277
260
|
sendXML(config) {
|
|
278
|
-
config.headers = {
|
|
279
|
-
...config.headers,
|
|
280
|
-
'Content-Type': http_1.ContentType.APPLICATION_XML,
|
|
281
|
-
};
|
|
261
|
+
config.headers = Object.assign(Object.assign({}, config.headers), { 'Content-Type': http_1.ContentType.APPLICATION_XML });
|
|
282
262
|
return this.sendRequest(config, false, false);
|
|
283
263
|
}
|
|
284
264
|
sendProtocolBuffer(config, isSynchronousRequest = false) {
|
|
285
|
-
config.headers = {
|
|
286
|
-
...config.headers,
|
|
287
|
-
'Content-Type': http_1.ContentType.APPLICATION_PROTOBUF,
|
|
288
|
-
};
|
|
265
|
+
config.headers = Object.assign(Object.assign({}, config.headers), { 'Content-Type': http_1.ContentType.APPLICATION_PROTOBUF });
|
|
289
266
|
return this.sendRequest(config, false, isSynchronousRequest);
|
|
290
267
|
}
|
|
291
268
|
sendProtocolMls(config, isSynchronousRequest = false) {
|
|
292
|
-
config.headers = {
|
|
293
|
-
...config.headers,
|
|
294
|
-
'Content-Type': http_1.ContentType.MESSAGES_MLS,
|
|
295
|
-
};
|
|
269
|
+
config.headers = Object.assign(Object.assign({}, config.headers), { 'Content-Type': http_1.ContentType.MESSAGES_MLS });
|
|
296
270
|
return this.sendRequest(config, false, isSynchronousRequest);
|
|
297
271
|
}
|
|
298
272
|
}
|
|
299
273
|
exports.HttpClient = HttpClient;
|
|
274
|
+
HttpClient.TOPIC = TOPIC;
|
package/lib/http/NetworkError.js
CHANGED
|
@@ -26,14 +26,9 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
26
26
|
const http_1 = require("../../http");
|
|
27
27
|
exports.NOTIFICATION_SIZE_MAXIMUM = 10000;
|
|
28
28
|
class NotificationAPI {
|
|
29
|
-
client;
|
|
30
29
|
constructor(client) {
|
|
31
30
|
this.client = client;
|
|
32
31
|
}
|
|
33
|
-
static URL = {
|
|
34
|
-
LAST: 'last',
|
|
35
|
-
NOTIFICATION: '/notifications',
|
|
36
|
-
};
|
|
37
32
|
/**
|
|
38
33
|
* Fetch the last notification.
|
|
39
34
|
* @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/push/getLastNotification
|
|
@@ -77,12 +72,13 @@ class NotificationAPI {
|
|
|
77
72
|
*/
|
|
78
73
|
async getAllNotifications(clientId, lastNotificationId) {
|
|
79
74
|
const getNotificationChunks = async (notificationList, currentClientId, currentNotificationId) => {
|
|
75
|
+
var _a, _b, _c, _d;
|
|
80
76
|
const defaultPayload = {
|
|
81
77
|
notifications: [],
|
|
82
78
|
time: '0',
|
|
83
79
|
has_more: false,
|
|
84
80
|
};
|
|
85
|
-
let payload = {
|
|
81
|
+
let payload = Object.assign({}, defaultPayload);
|
|
86
82
|
let hasMissedNotifications = false;
|
|
87
83
|
try {
|
|
88
84
|
payload = await this.getNotifications(currentClientId, exports.NOTIFICATION_SIZE_MAXIMUM, currentNotificationId);
|
|
@@ -90,20 +86,20 @@ class NotificationAPI {
|
|
|
90
86
|
catch (error) {
|
|
91
87
|
const isAxiosError = axios_1.default.isAxiosError(error);
|
|
92
88
|
//error with response body (before v3 API)
|
|
93
|
-
const isErrorWithNotifications = isAxiosError && error.response
|
|
89
|
+
const isErrorWithNotifications = isAxiosError && ((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.notifications);
|
|
94
90
|
//uuid parsing error
|
|
95
|
-
const isBadRequestError = isAxiosError && error.response
|
|
91
|
+
const isBadRequestError = isAxiosError && ((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) === http_1.StatusCode.BAD_REQUEST;
|
|
96
92
|
//notification was not found in the database,
|
|
97
93
|
const isNotFoundError = error instanceof http_1.BackendError && error.label === http_1.BackendErrorLabel.NOT_FOUND;
|
|
98
94
|
if (isBadRequestError || isNotFoundError) {
|
|
99
95
|
//we need to load all the notifications from the beginning (without 'since' param)
|
|
100
96
|
const payload = await getNotificationChunks(notificationList, currentClientId);
|
|
101
97
|
//we have to manually add missedNotification value since it won't be included when called without 'since' param
|
|
102
|
-
return {
|
|
98
|
+
return Object.assign(Object.assign({}, payload), { missedNotification: currentNotificationId });
|
|
103
99
|
}
|
|
104
100
|
if (isErrorWithNotifications) {
|
|
105
101
|
hasMissedNotifications = true;
|
|
106
|
-
payload = {
|
|
102
|
+
payload = Object.assign(Object.assign({}, defaultPayload), (_d = error.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
107
103
|
}
|
|
108
104
|
//throw error for other BackendError type errors
|
|
109
105
|
if (!isAxiosError) {
|
|
@@ -111,7 +107,7 @@ class NotificationAPI {
|
|
|
111
107
|
}
|
|
112
108
|
}
|
|
113
109
|
const { notifications, has_more } = payload;
|
|
114
|
-
if (notifications
|
|
110
|
+
if (notifications === null || notifications === void 0 ? void 0 : notifications.length) {
|
|
115
111
|
notificationList = notificationList.concat(notifications);
|
|
116
112
|
}
|
|
117
113
|
if (has_more) {
|
|
@@ -144,3 +140,7 @@ class NotificationAPI {
|
|
|
144
140
|
}
|
|
145
141
|
}
|
|
146
142
|
exports.NotificationAPI = NotificationAPI;
|
|
143
|
+
NotificationAPI.URL = {
|
|
144
|
+
LAST: 'last',
|
|
145
|
+
NOTIFICATION: '/notifications',
|
|
146
|
+
};
|
|
@@ -33,7 +33,7 @@ declare const client: HttpClient;
|
|
|
33
33
|
declare const notificationAPI: NotificationAPI;
|
|
34
34
|
declare const getAllNotificationsResult: () => Promise<{
|
|
35
35
|
notifications: import("..").Notification[];
|
|
36
|
-
missedNotification?: string;
|
|
36
|
+
missedNotification?: string | undefined;
|
|
37
37
|
}>;
|
|
38
38
|
export { client, notificationAPI, getAllNotificationsResult, mockedResultData, mockedNotificationId };
|
|
39
39
|
//# sourceMappingURL=NotificationsAPI.mocks.d.ts.map
|
package/lib/oauth/OAuthAPI.js
CHANGED
|
@@ -20,17 +20,9 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.OAuthAPI = void 0;
|
|
22
22
|
class OAuthAPI {
|
|
23
|
-
client;
|
|
24
23
|
constructor(client) {
|
|
25
24
|
this.client = client;
|
|
26
25
|
}
|
|
27
|
-
static URL = {
|
|
28
|
-
APPLICATIONS: 'applications',
|
|
29
|
-
AUTHORIZATION: 'authorization',
|
|
30
|
-
CODES: 'codes',
|
|
31
|
-
CLIENTS: 'clients',
|
|
32
|
-
OAUTH: '/oauth',
|
|
33
|
-
};
|
|
34
26
|
/**
|
|
35
27
|
* Get all OAuth applications.
|
|
36
28
|
*/
|
|
@@ -87,3 +79,10 @@ class OAuthAPI {
|
|
|
87
79
|
}
|
|
88
80
|
}
|
|
89
81
|
exports.OAuthAPI = OAuthAPI;
|
|
82
|
+
OAuthAPI.URL = {
|
|
83
|
+
APPLICATIONS: 'applications',
|
|
84
|
+
AUTHORIZATION: 'authorization',
|
|
85
|
+
CODES: 'codes',
|
|
86
|
+
CLIENTS: 'clients',
|
|
87
|
+
OAUTH: '/oauth',
|
|
88
|
+
};
|
|
@@ -22,10 +22,7 @@ exports.ObfuscationUtil = void 0;
|
|
|
22
22
|
const obfuscationLengthLimit = 20;
|
|
23
23
|
const obfuscateAccessToken = (accessToken, enabled = true) => {
|
|
24
24
|
if (enabled) {
|
|
25
|
-
return {
|
|
26
|
-
...accessToken,
|
|
27
|
-
access_token: `${accessToken.access_token.substr(0, obfuscationLengthLimit)}...`,
|
|
28
|
-
};
|
|
25
|
+
return Object.assign(Object.assign({}, accessToken), { access_token: `${accessToken.access_token.substr(0, obfuscationLengthLimit)}...` });
|
|
29
26
|
}
|
|
30
27
|
return accessToken;
|
|
31
28
|
};
|
package/lib/self/SelfAPI.js
CHANGED
|
@@ -20,21 +20,9 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.SelfAPI = void 0;
|
|
22
22
|
class SelfAPI {
|
|
23
|
-
client;
|
|
24
23
|
constructor(client) {
|
|
25
24
|
this.client = client;
|
|
26
25
|
}
|
|
27
|
-
static URL = {
|
|
28
|
-
CONSENT: 'consent',
|
|
29
|
-
EMAIL: 'email',
|
|
30
|
-
HANDLE: 'handle',
|
|
31
|
-
LOCALE: 'locale',
|
|
32
|
-
NAME: 'name',
|
|
33
|
-
PASSWORD: 'password',
|
|
34
|
-
PHONE: 'phone',
|
|
35
|
-
SUPPORTED_PROTOCOLS: 'supported-protocols',
|
|
36
|
-
SELF: '/self',
|
|
37
|
-
};
|
|
38
26
|
/**
|
|
39
27
|
* Remove your email address.
|
|
40
28
|
* @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/users/removeEmail
|
|
@@ -210,3 +198,14 @@ class SelfAPI {
|
|
|
210
198
|
}
|
|
211
199
|
}
|
|
212
200
|
exports.SelfAPI = SelfAPI;
|
|
201
|
+
SelfAPI.URL = {
|
|
202
|
+
CONSENT: 'consent',
|
|
203
|
+
EMAIL: 'email',
|
|
204
|
+
HANDLE: 'handle',
|
|
205
|
+
LOCALE: 'locale',
|
|
206
|
+
NAME: 'name',
|
|
207
|
+
PASSWORD: 'password',
|
|
208
|
+
PHONE: 'phone',
|
|
209
|
+
SUPPORTED_PROTOCOLS: 'supported-protocols',
|
|
210
|
+
SELF: '/self',
|
|
211
|
+
};
|
|
@@ -20,17 +20,9 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.ServiceProviderAPI = void 0;
|
|
22
22
|
class ServiceProviderAPI {
|
|
23
|
-
client;
|
|
24
23
|
constructor(client) {
|
|
25
24
|
this.client = client;
|
|
26
25
|
}
|
|
27
|
-
static URL = {
|
|
28
|
-
COMPLETE: 'complete',
|
|
29
|
-
LOGIN: 'login',
|
|
30
|
-
PASSWORD_RESET: 'password-reset',
|
|
31
|
-
PROVIDER: '/provider',
|
|
32
|
-
REGISTER: 'register',
|
|
33
|
-
};
|
|
34
26
|
async deleteServiceProvider(data) {
|
|
35
27
|
const config = {
|
|
36
28
|
data,
|
|
@@ -91,3 +83,10 @@ class ServiceProviderAPI {
|
|
|
91
83
|
}
|
|
92
84
|
}
|
|
93
85
|
exports.ServiceProviderAPI = ServiceProviderAPI;
|
|
86
|
+
ServiceProviderAPI.URL = {
|
|
87
|
+
COMPLETE: 'complete',
|
|
88
|
+
LOGIN: 'login',
|
|
89
|
+
PASSWORD_RESET: 'password-reset',
|
|
90
|
+
PROVIDER: '/provider',
|
|
91
|
+
REGISTER: 'register',
|
|
92
|
+
};
|
|
@@ -20,23 +20,10 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.ServicesAPI = void 0;
|
|
22
22
|
class ServicesAPI {
|
|
23
|
-
client;
|
|
24
|
-
assetAPI;
|
|
25
23
|
constructor(client, assetAPI) {
|
|
26
24
|
this.client = client;
|
|
27
25
|
this.assetAPI = assetAPI;
|
|
28
26
|
}
|
|
29
|
-
static URL = {
|
|
30
|
-
ASSETS: 'assets',
|
|
31
|
-
BOT: '/bot',
|
|
32
|
-
CLIENT: 'client',
|
|
33
|
-
CLIENTS: 'clients',
|
|
34
|
-
CONVERSATION: 'conversation',
|
|
35
|
-
MESSAGES: 'messages',
|
|
36
|
-
PREKEYS: 'prekeys',
|
|
37
|
-
SELF: 'self',
|
|
38
|
-
USERS: 'users',
|
|
39
|
-
};
|
|
40
27
|
/**
|
|
41
28
|
* Delete the service, thereby removing it from the conversation it is in.
|
|
42
29
|
*
|
|
@@ -181,3 +168,14 @@ class ServicesAPI {
|
|
|
181
168
|
}
|
|
182
169
|
}
|
|
183
170
|
exports.ServicesAPI = ServicesAPI;
|
|
171
|
+
ServicesAPI.URL = {
|
|
172
|
+
ASSETS: 'assets',
|
|
173
|
+
BOT: '/bot',
|
|
174
|
+
CLIENT: 'client',
|
|
175
|
+
CLIENTS: 'clients',
|
|
176
|
+
CONVERSATION: 'conversation',
|
|
177
|
+
MESSAGES: 'messages',
|
|
178
|
+
PREKEYS: 'prekeys',
|
|
179
|
+
SELF: 'self',
|
|
180
|
+
USERS: 'users',
|
|
181
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../../src/shims/browser/cookie.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAE,aAAa,EAAC,MAAM,OAAO,CAAC;AAExD,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAEvC,eAAO,MAAM,cAAc,aAAc,
|
|
1
|
+
{"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../../src/shims/browser/cookie.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAE,aAAa,EAAC,MAAM,OAAO,CAAC;AAExD,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAEvC,eAAO,MAAM,cAAc,aAAc,cAAc,eAAe,CAAC,KAAG,QAAQ,eAAe,CACjE,CAAC;AAEjC,eAAO,MAAM,qBAAqB,cAAe,UAAU,UAAU,kBAAkB,KAAG,QAAQ,cAAc,CAAC,CAAC,CAClF,CAAC"}
|