attlaz-client 1.22.5 → 1.23.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/dist/Model/Messaging/ChannelHistory.d.ts +4 -4
- package/dist/Model/Messaging/ChannelHistory.js +2 -2
- package/dist/Model/User/UserNotificationSession.d.ts +13 -0
- package/dist/Model/User/UserNotificationSession.js +11 -0
- package/dist/Service/UserEndpoint.d.ts +4 -1
- package/dist/Service/UserEndpoint.js +30 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -3,8 +3,8 @@ export declare class ChannelHistory {
|
|
|
3
3
|
subscriberId: string;
|
|
4
4
|
channelId: string;
|
|
5
5
|
time: Date;
|
|
6
|
-
message:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
static parse(rawChannelHistory:
|
|
6
|
+
message: unknown;
|
|
7
|
+
result: unknown;
|
|
8
|
+
status: string;
|
|
9
|
+
static parse(rawChannelHistory: Record<string, unknown>): ChannelHistory;
|
|
10
10
|
}
|
|
@@ -5,8 +5,8 @@ export class ChannelHistory {
|
|
|
5
5
|
channelId;
|
|
6
6
|
time;
|
|
7
7
|
message;
|
|
8
|
-
success;
|
|
9
8
|
result;
|
|
9
|
+
status;
|
|
10
10
|
// public constructor(id: number, subscriber: string, channel: number, time: Date, message: string = '', success: boolean = true, result: string = '') {
|
|
11
11
|
// this.id = id;
|
|
12
12
|
// this.subscriber = subscriber;
|
|
@@ -24,8 +24,8 @@ export class ChannelHistory {
|
|
|
24
24
|
log.channelId = rawChannelHistory.channel;
|
|
25
25
|
log.time = Utils.parseRawDate(rawChannelHistory.time);
|
|
26
26
|
log.message = rawChannelHistory.message;
|
|
27
|
-
log.success = Utils.isTrue(rawChannelHistory.success);
|
|
28
27
|
log.result = rawChannelHistory.result;
|
|
28
|
+
log.status = rawChannelHistory.status;
|
|
29
29
|
return log;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { State } from '../State.js';
|
|
2
|
+
import { StateAware } from '../StateAware.js';
|
|
3
|
+
export declare class UserNotificationSession implements StateAware {
|
|
4
|
+
id: string;
|
|
5
|
+
session: string;
|
|
6
|
+
subscription: unknown;
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
updatedAt: Date;
|
|
9
|
+
expiresAt: Date;
|
|
10
|
+
state: State;
|
|
11
|
+
os: string;
|
|
12
|
+
browser: string;
|
|
13
|
+
}
|
|
@@ -2,6 +2,8 @@ import { UserAuthProvider } from '../Model/User/UserAuthProvider.js';
|
|
|
2
2
|
import { User } from '../Model/User/User.js';
|
|
3
3
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
4
4
|
import { Endpoint } from './Endpoint.js';
|
|
5
|
+
import { UserNotificationSession } from '../Model/User/UserNotificationSession.js';
|
|
6
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
5
7
|
export declare class UserEndpoint extends Endpoint {
|
|
6
8
|
getUser(): Promise<User | null>;
|
|
7
9
|
removeAuthProvider(providerId: string): Promise<boolean>;
|
|
@@ -14,5 +16,6 @@ export declare class UserEndpoint extends Endpoint {
|
|
|
14
16
|
create(user: User, password: string, invitationCode?: string | null): Promise<User>;
|
|
15
17
|
requestResetPassword(email: string): Promise<boolean>;
|
|
16
18
|
resetPassword(code: string, password: string): Promise<boolean>;
|
|
17
|
-
createWebPush(
|
|
19
|
+
createWebPush(session: UserNotificationSession): Promise<boolean>;
|
|
20
|
+
getSessions(pagination: CursorPagination): Promise<CollectionResult<UserNotificationSession>>;
|
|
18
21
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { UserAuthProvider } from '../Model/User/UserAuthProvider.js';
|
|
2
2
|
import { User } from '../Model/User/User.js';
|
|
3
3
|
import { Endpoint } from './Endpoint.js';
|
|
4
|
+
import { UserNotificationSession } from '../Model/User/UserNotificationSession.js';
|
|
5
|
+
import { QueryString } from '../Http/Data/QueryString.js';
|
|
6
|
+
import { State } from '../Model/State.js';
|
|
4
7
|
export class UserEndpoint extends Endpoint {
|
|
5
8
|
async getUser() {
|
|
6
9
|
const cmd = '/users';
|
|
@@ -111,11 +114,18 @@ export class UserEndpoint extends Endpoint {
|
|
|
111
114
|
throw e;
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
|
-
async createWebPush(
|
|
117
|
+
async createWebPush(session) {
|
|
115
118
|
try {
|
|
116
119
|
const url = '/webpush';
|
|
120
|
+
const data = {
|
|
121
|
+
session: session.session,
|
|
122
|
+
subscription: session.subscription,
|
|
123
|
+
expires_at: session.expiresAt,
|
|
124
|
+
os: session.os,
|
|
125
|
+
browser: session.browser,
|
|
126
|
+
};
|
|
117
127
|
const parser = (raw) => ({ created: raw.created });
|
|
118
|
-
const result = await this.requestObject(url,
|
|
128
|
+
const result = await this.requestObject(url, data, parser, 'POST', true);
|
|
119
129
|
const re = result.getData();
|
|
120
130
|
if (re === null) {
|
|
121
131
|
console.log('created web push wrong data', { result, parsed: re });
|
|
@@ -130,4 +140,22 @@ export class UserEndpoint extends Endpoint {
|
|
|
130
140
|
throw e;
|
|
131
141
|
}
|
|
132
142
|
}
|
|
143
|
+
async getSessions(pagination) {
|
|
144
|
+
const queryString = new QueryString('/webpush');
|
|
145
|
+
queryString.addPagination(pagination);
|
|
146
|
+
const parser = (raw) => {
|
|
147
|
+
const session = new UserNotificationSession();
|
|
148
|
+
session.id = raw.id;
|
|
149
|
+
session.session = raw.session;
|
|
150
|
+
session.state = State.fromString(raw.state);
|
|
151
|
+
session.createdAt = raw.created_at;
|
|
152
|
+
session.updatedAt = raw.updated_at;
|
|
153
|
+
session.expiresAt = raw.expires_at;
|
|
154
|
+
session.os = raw.os;
|
|
155
|
+
session.browser = raw.browser;
|
|
156
|
+
return session;
|
|
157
|
+
};
|
|
158
|
+
const rawTriggers = await this.requestCollection(queryString, parser);
|
|
159
|
+
return rawTriggers;
|
|
160
|
+
}
|
|
133
161
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.23.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.23.0";
|