@wireapp/api-client 19.2.5 → 19.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [19.3.2](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/compare/@wireapp/api-client@19.3.1...@wireapp/api-client@19.3.2) (2022-05-31)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @wireapp/api-client
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [19.3.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/compare/@wireapp/api-client@19.3.0...@wireapp/api-client@19.3.1) (2022-05-31)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @wireapp/api-client
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [19.3.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/compare/@wireapp/api-client@19.2.5...@wireapp/api-client@19.3.0) (2022-05-30)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* Add missed notifications hook ([#4275](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/issues/4275)) ([f81217b](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/commit/f81217bad53fed2e4fb163c6ae871b39ca16cf58))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [19.2.5](https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/compare/@wireapp/api-client@19.2.4...@wireapp/api-client@19.2.5) (2022-05-30)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @wireapp/api-client
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@types/jasmine": "3.8.2",
|
|
30
30
|
"@types/karma": "6.3.1",
|
|
31
31
|
"@types/ws": "7.4.7",
|
|
32
|
-
"@wireapp/react-ui-kit": "8.
|
|
32
|
+
"@wireapp/react-ui-kit": "8.5.1",
|
|
33
33
|
"@wireapp/store-engine": "4.9.9",
|
|
34
34
|
"@wireapp/store-engine-fs": "2.4.9",
|
|
35
35
|
"babel-loader": "8.2.2",
|
|
@@ -90,6 +90,6 @@
|
|
|
90
90
|
"test:types": "tsc --noEmit",
|
|
91
91
|
"watch": "webpack serve --config webpack.browser.js"
|
|
92
92
|
},
|
|
93
|
-
"version": "19.2
|
|
94
|
-
"gitHead": "
|
|
93
|
+
"version": "19.3.2",
|
|
94
|
+
"gitHead": "548874558f9f764a6560596d98122075bc8c9f91"
|
|
95
95
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { HttpClient } from '../http/';
|
|
2
2
|
import type { Notification, NotificationList } from './';
|
|
3
3
|
export declare const NOTIFICATION_SIZE_MAXIMUM = 10000;
|
|
4
|
+
declare type NotificationsReponse = {
|
|
5
|
+
notifications: Notification[];
|
|
6
|
+
missedNotification?: string;
|
|
7
|
+
};
|
|
4
8
|
export declare class NotificationAPI {
|
|
5
9
|
private readonly client;
|
|
6
10
|
constructor(client: HttpClient);
|
|
@@ -27,10 +31,11 @@ export declare class NotificationAPI {
|
|
|
27
31
|
* @param lastNotificationId Only return notifications more recent than this
|
|
28
32
|
* @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/push/fetchNotifications
|
|
29
33
|
*/
|
|
30
|
-
getAllNotifications(clientId?: string, lastNotificationId?: string): Promise<
|
|
34
|
+
getAllNotifications(clientId?: string, lastNotificationId?: string): Promise<NotificationsReponse>;
|
|
31
35
|
/**
|
|
32
36
|
* Fetch a notification by ID.
|
|
33
37
|
* @see https://staging-nginz-https.zinfra.io/swagger-ui/#!/push/getNotification
|
|
34
38
|
*/
|
|
35
39
|
getNotification(notificationId: string, clientId?: string): Promise<Notification>;
|
|
36
40
|
}
|
|
41
|
+
export {};
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.NotificationAPI = exports.NOTIFICATION_SIZE_MAXIMUM = void 0;
|
|
22
|
+
const http_1 = require("../http/");
|
|
22
23
|
exports.NOTIFICATION_SIZE_MAXIMUM = 10000;
|
|
23
24
|
class NotificationAPI {
|
|
24
25
|
constructor(client) {
|
|
@@ -67,18 +68,40 @@ class NotificationAPI {
|
|
|
67
68
|
*/
|
|
68
69
|
async getAllNotifications(clientId, lastNotificationId) {
|
|
69
70
|
let notificationList = [];
|
|
70
|
-
const getNotificationChunks = async (
|
|
71
|
-
|
|
71
|
+
const getNotificationChunks = async (currentClientId, currentNotificationId) => {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
let payload = {
|
|
74
|
+
notifications: [],
|
|
75
|
+
time: '0',
|
|
76
|
+
has_more: false,
|
|
77
|
+
};
|
|
78
|
+
let hasMissedNotifications = false;
|
|
79
|
+
try {
|
|
80
|
+
payload = await this.getNotifications(currentClientId, exports.NOTIFICATION_SIZE_MAXIMUM, currentNotificationId);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
if (http_1.HttpClient.isAxiosError(error)) {
|
|
84
|
+
payload = ((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.notifications) ? error.response.data : payload;
|
|
85
|
+
hasMissedNotifications = true;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const { notifications, has_more } = payload;
|
|
72
92
|
if (notifications.length) {
|
|
73
93
|
notificationList = notificationList.concat(notifications);
|
|
74
94
|
}
|
|
75
95
|
if (has_more) {
|
|
76
96
|
const lastNotification = notifications[notifications.length - 1];
|
|
77
97
|
if (lastNotification) {
|
|
78
|
-
return getNotificationChunks(
|
|
98
|
+
return getNotificationChunks(currentClientId, lastNotification.id);
|
|
79
99
|
}
|
|
80
100
|
}
|
|
81
|
-
return
|
|
101
|
+
return {
|
|
102
|
+
notifications: notificationList,
|
|
103
|
+
missedNotification: hasMissedNotifications ? currentNotificationId : undefined,
|
|
104
|
+
};
|
|
82
105
|
};
|
|
83
106
|
return getNotificationChunks(clientId, lastNotificationId);
|
|
84
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationAPI.js","sourceRoot":"","sources":["NotificationAPI.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;
|
|
1
|
+
{"version":3,"file":"NotificationAPI.js","sourceRoot":"","sources":["NotificationAPI.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAIH,mCAAoC;AAGvB,QAAA,yBAAyB,GAAG,KAAK,CAAC;AAO/C,MAAa,eAAe;IAC1B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAOnD;;;OAGG;IACI,KAAK,CAAC,mBAAmB,CAAC,QAAiB;QAChD,MAAM,MAAM,GAAuB;YACjC,MAAM,EAAE,KAAK;YACb,MAAM,EAAE;gBACN,MAAM,EAAE,QAAQ;aACjB;YACD,GAAG,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,YAAY,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE;SACvE,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAe,MAAM,CAAC,CAAC;QAClE,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,gBAAgB,CAC3B,QAAiB,EACjB,OAAe,iCAAyB,EACxC,KAAc;QAEd,MAAM,MAAM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