mezon-js 2.9.83 → 2.9.84
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/api.gen.ts +16 -0
- package/client.ts +69 -61
- package/dist/api.gen.d.ts +8 -0
- package/dist/client.d.ts +5 -1
- package/dist/mezon-js.cjs.js +33 -6
- package/dist/mezon-js.esm.mjs +33 -6
- package/dist/socket.d.ts +5 -0
- package/package.json +1 -1
- package/socket.ts +60 -22
package/api.gen.ts
CHANGED
|
@@ -133,12 +133,18 @@ export enum ApiAppRole {
|
|
|
133
133
|
|
|
134
134
|
/** Update fields in a given channel. */
|
|
135
135
|
export interface MezonUpdateChannelDescBody {
|
|
136
|
+
//
|
|
137
|
+
age_restricted?: number;
|
|
136
138
|
//
|
|
137
139
|
app_url?: string;
|
|
138
140
|
//
|
|
139
141
|
category_id?: string;
|
|
140
142
|
//
|
|
141
143
|
channel_label?: string;
|
|
144
|
+
//
|
|
145
|
+
e2ee?: number;
|
|
146
|
+
//
|
|
147
|
+
topic?: string;
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
/** */
|
|
@@ -683,6 +689,8 @@ export interface ApiChannelDescription {
|
|
|
683
689
|
//
|
|
684
690
|
active?: number;
|
|
685
691
|
//
|
|
692
|
+
age_restricted?: number;
|
|
693
|
+
//
|
|
686
694
|
app_url?: string;
|
|
687
695
|
//
|
|
688
696
|
category_id?: string;
|
|
@@ -709,6 +717,8 @@ export interface ApiChannelDescription {
|
|
|
709
717
|
//
|
|
710
718
|
creator_name?: string;
|
|
711
719
|
//
|
|
720
|
+
e2ee?: number;
|
|
721
|
+
//
|
|
712
722
|
is_mute?: boolean;
|
|
713
723
|
//
|
|
714
724
|
last_pin_message?: string;
|
|
@@ -724,6 +734,8 @@ export interface ApiChannelDescription {
|
|
|
724
734
|
parrent_id?: string;
|
|
725
735
|
//
|
|
726
736
|
is_online?: Array<boolean>;
|
|
737
|
+
//
|
|
738
|
+
topic?: string;
|
|
727
739
|
//The channel type.
|
|
728
740
|
type?: number;
|
|
729
741
|
//
|
|
@@ -2177,6 +2189,8 @@ export interface ApiUpdateAccountRequest {
|
|
|
2177
2189
|
about_me?: string;
|
|
2178
2190
|
//A URL for an avatar image.
|
|
2179
2191
|
avatar_url?: string;
|
|
2192
|
+
//
|
|
2193
|
+
dob?: string;
|
|
2180
2194
|
//The display name of the user.
|
|
2181
2195
|
display_name?: string;
|
|
2182
2196
|
//The language expected to be a tag which follows the BCP-47 spec.
|
|
@@ -2258,6 +2272,8 @@ export interface ApiUser {
|
|
|
2258
2272
|
apple_id?: string;
|
|
2259
2273
|
//A URL for an avatar image.
|
|
2260
2274
|
avatar_url?: string;
|
|
2275
|
+
//
|
|
2276
|
+
dob?: string;
|
|
2261
2277
|
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user was created.
|
|
2262
2278
|
create_time?: string;
|
|
2263
2279
|
//The display name of the user.
|
package/client.ts
CHANGED
|
@@ -191,9 +191,10 @@ export enum NotificationType {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
export enum WebrtcSignalingType {
|
|
194
|
-
WEBRTC_SDP_OFFER
|
|
195
|
-
WEBRTC_SDP_ANSWER
|
|
196
|
-
WEBRTC_ICE_CANDIDATE = 3
|
|
194
|
+
WEBRTC_SDP_OFFER = 1,
|
|
195
|
+
WEBRTC_SDP_ANSWER = 2,
|
|
196
|
+
WEBRTC_ICE_CANDIDATE = 3,
|
|
197
|
+
WEBRTC_SDP_QUIT = 4,
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
/** Response for an RPC function executed on the server. */
|
|
@@ -446,6 +447,12 @@ export interface ApiUpdateChannelDescRequest {
|
|
|
446
447
|
category_id: string | undefined;
|
|
447
448
|
/** The app url of channel */
|
|
448
449
|
app_url: string | undefined;
|
|
450
|
+
//
|
|
451
|
+
e2ee?: number;
|
|
452
|
+
//
|
|
453
|
+
topic?: string;
|
|
454
|
+
//
|
|
455
|
+
age_restricted?: number;
|
|
449
456
|
}
|
|
450
457
|
|
|
451
458
|
/** Add users to a channel. */
|
|
@@ -3201,7 +3208,11 @@ export class Client {
|
|
|
3201
3208
|
}
|
|
3202
3209
|
|
|
3203
3210
|
//**disabled webhook by id */
|
|
3204
|
-
async deleteWebhookById(
|
|
3211
|
+
async deleteWebhookById(
|
|
3212
|
+
session: Session,
|
|
3213
|
+
id: string,
|
|
3214
|
+
request: MezonDeleteWebhookByIdBody
|
|
3215
|
+
) {
|
|
3205
3216
|
if (
|
|
3206
3217
|
this.autoRefreshSession &&
|
|
3207
3218
|
session.refresh_token &&
|
|
@@ -4239,9 +4250,7 @@ export class Client {
|
|
|
4239
4250
|
});
|
|
4240
4251
|
}
|
|
4241
4252
|
/** List activity */
|
|
4242
|
-
async listActivity(
|
|
4243
|
-
session: Session
|
|
4244
|
-
): Promise<ApiListUserActivity> {
|
|
4253
|
+
async listActivity(session: Session): Promise<ApiListUserActivity> {
|
|
4245
4254
|
if (
|
|
4246
4255
|
this.autoRefreshSession &&
|
|
4247
4256
|
session.refresh_token &&
|
|
@@ -4250,11 +4259,9 @@ export class Client {
|
|
|
4250
4259
|
await this.sessionRefresh(session);
|
|
4251
4260
|
}
|
|
4252
4261
|
|
|
4253
|
-
return this.apiClient
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
return response;
|
|
4257
|
-
});
|
|
4262
|
+
return this.apiClient.listActivity(session.token).then((response: any) => {
|
|
4263
|
+
return response;
|
|
4264
|
+
});
|
|
4258
4265
|
}
|
|
4259
4266
|
|
|
4260
4267
|
async createActiviy(
|
|
@@ -4285,26 +4292,26 @@ export class Client {
|
|
|
4285
4292
|
const response = {
|
|
4286
4293
|
login_id: apiSession.login_id,
|
|
4287
4294
|
create_time_second: apiSession.create_time_second,
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
return response
|
|
4295
|
+
};
|
|
4296
|
+
return response;
|
|
4291
4297
|
}
|
|
4292
4298
|
|
|
4293
|
-
async checkLoginRequest(
|
|
4299
|
+
async checkLoginRequest(
|
|
4300
|
+
requet: ApiConfirmLoginRequest
|
|
4301
|
+
): Promise<Session | null> {
|
|
4294
4302
|
const apiSession = await this.apiClient.checkLoginRequest(
|
|
4295
4303
|
this.serverkey,
|
|
4296
4304
|
"",
|
|
4297
4305
|
requet
|
|
4298
4306
|
);
|
|
4299
4307
|
if (!apiSession?.token) {
|
|
4300
|
-
return null
|
|
4308
|
+
return null;
|
|
4301
4309
|
}
|
|
4302
4310
|
return new Session(
|
|
4303
4311
|
apiSession.token || "",
|
|
4304
4312
|
apiSession.refresh_token || "",
|
|
4305
4313
|
apiSession.created || false
|
|
4306
4314
|
);
|
|
4307
|
-
|
|
4308
4315
|
}
|
|
4309
4316
|
|
|
4310
4317
|
async confirmLogin(
|
|
@@ -4326,9 +4333,10 @@ export class Client {
|
|
|
4326
4333
|
});
|
|
4327
4334
|
}
|
|
4328
4335
|
|
|
4329
|
-
async getChanEncryptionMethod(
|
|
4336
|
+
async getChanEncryptionMethod(
|
|
4337
|
+
session: Session,
|
|
4330
4338
|
channelId: string
|
|
4331
|
-
)
|
|
4339
|
+
): Promise<ApiChanEncryptionMethod> {
|
|
4332
4340
|
if (
|
|
4333
4341
|
this.autoRefreshSession &&
|
|
4334
4342
|
session.refresh_token &&
|
|
@@ -4344,27 +4352,30 @@ export class Client {
|
|
|
4344
4352
|
});
|
|
4345
4353
|
}
|
|
4346
4354
|
|
|
4347
|
-
async setChanEncryptionMethod(
|
|
4355
|
+
async setChanEncryptionMethod(
|
|
4356
|
+
session: Session,
|
|
4348
4357
|
channelId: string,
|
|
4349
|
-
method: string
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
)
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
return this.apiClient
|
|
4359
|
-
.setChanEncryptionMethod(session.token, channelId, { method: method })
|
|
4360
|
-
.then((response: any) => {
|
|
4361
|
-
return response;
|
|
4362
|
-
});
|
|
4358
|
+
method: string
|
|
4359
|
+
): Promise<any> {
|
|
4360
|
+
if (
|
|
4361
|
+
this.autoRefreshSession &&
|
|
4362
|
+
session.refresh_token &&
|
|
4363
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
|
4364
|
+
) {
|
|
4365
|
+
await this.sessionRefresh(session);
|
|
4363
4366
|
}
|
|
4364
4367
|
|
|
4365
|
-
|
|
4368
|
+
return this.apiClient
|
|
4369
|
+
.setChanEncryptionMethod(session.token, channelId, { method: method })
|
|
4370
|
+
.then((response: any) => {
|
|
4371
|
+
return response;
|
|
4372
|
+
});
|
|
4373
|
+
}
|
|
4374
|
+
|
|
4375
|
+
async getPubKeys(
|
|
4376
|
+
session: Session,
|
|
4366
4377
|
userIds: Array<string>
|
|
4367
|
-
)
|
|
4378
|
+
): Promise<ApiGetPubKeysResponse> {
|
|
4368
4379
|
if (
|
|
4369
4380
|
this.autoRefreshSession &&
|
|
4370
4381
|
session.refresh_token &&
|
|
@@ -4380,9 +4391,10 @@ export class Client {
|
|
|
4380
4391
|
});
|
|
4381
4392
|
}
|
|
4382
4393
|
|
|
4383
|
-
async pushPubKey(
|
|
4394
|
+
async pushPubKey(
|
|
4395
|
+
session: Session,
|
|
4384
4396
|
PK: ApiPubKey
|
|
4385
|
-
)
|
|
4397
|
+
): Promise<ApiGetPubKeysResponse> {
|
|
4386
4398
|
if (
|
|
4387
4399
|
this.autoRefreshSession &&
|
|
4388
4400
|
session.refresh_token &&
|
|
@@ -4398,7 +4410,7 @@ export class Client {
|
|
|
4398
4410
|
});
|
|
4399
4411
|
}
|
|
4400
4412
|
|
|
4401
|
-
async getKeyServer(session: Session)
|
|
4413
|
+
async getKeyServer(session: Session): Promise<ApiGetKeyServerResp> {
|
|
4402
4414
|
if (
|
|
4403
4415
|
this.autoRefreshSession &&
|
|
4404
4416
|
session.refresh_token &&
|
|
@@ -4416,12 +4428,12 @@ export class Client {
|
|
|
4416
4428
|
|
|
4417
4429
|
async listAuditLog(
|
|
4418
4430
|
session: Session,
|
|
4419
|
-
actionLog?:string,
|
|
4420
|
-
userId?:string,
|
|
4421
|
-
clanId?:string,
|
|
4422
|
-
page?:number,
|
|
4423
|
-
pageSize?:number
|
|
4424
|
-
)
|
|
4431
|
+
actionLog?: string,
|
|
4432
|
+
userId?: string,
|
|
4433
|
+
clanId?: string,
|
|
4434
|
+
page?: number,
|
|
4435
|
+
pageSize?: number
|
|
4436
|
+
): Promise<MezonapiListAuditLog> {
|
|
4425
4437
|
if (
|
|
4426
4438
|
this.autoRefreshSession &&
|
|
4427
4439
|
session.refresh_token &&
|
|
@@ -4438,12 +4450,12 @@ export class Client {
|
|
|
4438
4450
|
}
|
|
4439
4451
|
|
|
4440
4452
|
async listOnboarding(
|
|
4441
|
-
session: Session,
|
|
4442
|
-
clanId?:string,
|
|
4443
|
-
guideType?:number,
|
|
4444
|
-
limit?:number,
|
|
4445
|
-
page?:number
|
|
4446
|
-
)
|
|
4453
|
+
session: Session,
|
|
4454
|
+
clanId?: string,
|
|
4455
|
+
guideType?: number,
|
|
4456
|
+
limit?: number,
|
|
4457
|
+
page?: number
|
|
4458
|
+
): Promise<ApiListOnboardingResponse> {
|
|
4447
4459
|
if (
|
|
4448
4460
|
this.autoRefreshSession &&
|
|
4449
4461
|
session.refresh_token &&
|
|
@@ -4462,7 +4474,7 @@ export class Client {
|
|
|
4462
4474
|
async getOnboardingDetail(
|
|
4463
4475
|
session: Session,
|
|
4464
4476
|
id: string,
|
|
4465
|
-
clanId?: string
|
|
4477
|
+
clanId?: string
|
|
4466
4478
|
): Promise<ApiOnboardingItem> {
|
|
4467
4479
|
if (
|
|
4468
4480
|
this.autoRefreshSession &&
|
|
@@ -4520,8 +4532,8 @@ export class Client {
|
|
|
4520
4532
|
|
|
4521
4533
|
async deleteOnboarding(
|
|
4522
4534
|
session: Session,
|
|
4523
|
-
id:string,
|
|
4524
|
-
clanId?:string
|
|
4535
|
+
id: string,
|
|
4536
|
+
clanId?: string
|
|
4525
4537
|
): Promise<any> {
|
|
4526
4538
|
if (
|
|
4527
4539
|
this.autoRefreshSession &&
|
|
@@ -4557,7 +4569,7 @@ export class Client {
|
|
|
4557
4569
|
return Promise.resolve(response);
|
|
4558
4570
|
});
|
|
4559
4571
|
}
|
|
4560
|
-
|
|
4572
|
+
|
|
4561
4573
|
//**list webhook belong to the clan */
|
|
4562
4574
|
async listClanWebhook(
|
|
4563
4575
|
session: Session,
|
|
@@ -4579,11 +4591,7 @@ export class Client {
|
|
|
4579
4591
|
}
|
|
4580
4592
|
|
|
4581
4593
|
//**disabled webhook by id */
|
|
4582
|
-
async deleteClanWebhookById(
|
|
4583
|
-
session: Session,
|
|
4584
|
-
id: string,
|
|
4585
|
-
clan_id: string
|
|
4586
|
-
) {
|
|
4594
|
+
async deleteClanWebhookById(session: Session, id: string, clan_id: string) {
|
|
4587
4595
|
if (
|
|
4588
4596
|
this.autoRefreshSession &&
|
|
4589
4597
|
session.refresh_token &&
|
package/dist/api.gen.d.ts
CHANGED
|
@@ -79,9 +79,12 @@ export declare enum ApiAppRole {
|
|
|
79
79
|
}
|
|
80
80
|
/** Update fields in a given channel. */
|
|
81
81
|
export interface MezonUpdateChannelDescBody {
|
|
82
|
+
age_restricted?: number;
|
|
82
83
|
app_url?: string;
|
|
83
84
|
category_id?: string;
|
|
84
85
|
channel_label?: string;
|
|
86
|
+
e2ee?: number;
|
|
87
|
+
topic?: string;
|
|
85
88
|
}
|
|
86
89
|
/** */
|
|
87
90
|
export interface MezonUpdateClanDescBody {
|
|
@@ -401,6 +404,7 @@ export interface ApiChannelDescList {
|
|
|
401
404
|
/** */
|
|
402
405
|
export interface ApiChannelDescription {
|
|
403
406
|
active?: number;
|
|
407
|
+
age_restricted?: number;
|
|
404
408
|
app_url?: string;
|
|
405
409
|
category_id?: string;
|
|
406
410
|
category_name?: string;
|
|
@@ -414,6 +418,7 @@ export interface ApiChannelDescription {
|
|
|
414
418
|
create_time_seconds?: number;
|
|
415
419
|
creator_id?: string;
|
|
416
420
|
creator_name?: string;
|
|
421
|
+
e2ee?: number;
|
|
417
422
|
is_mute?: boolean;
|
|
418
423
|
last_pin_message?: string;
|
|
419
424
|
last_seen_message?: ApiChannelMessageHeader;
|
|
@@ -422,6 +427,7 @@ export interface ApiChannelDescription {
|
|
|
422
427
|
meeting_uri?: string;
|
|
423
428
|
parrent_id?: string;
|
|
424
429
|
is_online?: Array<boolean>;
|
|
430
|
+
topic?: string;
|
|
425
431
|
type?: number;
|
|
426
432
|
update_time_seconds?: number;
|
|
427
433
|
user_id?: Array<string>;
|
|
@@ -1267,6 +1273,7 @@ export interface ApiTokenSentEvent {
|
|
|
1267
1273
|
export interface ApiUpdateAccountRequest {
|
|
1268
1274
|
about_me?: string;
|
|
1269
1275
|
avatar_url?: string;
|
|
1276
|
+
dob?: string;
|
|
1270
1277
|
display_name?: string;
|
|
1271
1278
|
lang_tag?: string;
|
|
1272
1279
|
location?: string;
|
|
@@ -1315,6 +1322,7 @@ export interface ApiUser {
|
|
|
1315
1322
|
about_me?: string;
|
|
1316
1323
|
apple_id?: string;
|
|
1317
1324
|
avatar_url?: string;
|
|
1325
|
+
dob?: string;
|
|
1318
1326
|
create_time?: string;
|
|
1319
1327
|
display_name?: string;
|
|
1320
1328
|
edge_count?: number;
|
package/dist/client.d.ts
CHANGED
|
@@ -43,7 +43,8 @@ export declare enum NotificationType {
|
|
|
43
43
|
export declare enum WebrtcSignalingType {
|
|
44
44
|
WEBRTC_SDP_OFFER = 1,
|
|
45
45
|
WEBRTC_SDP_ANSWER = 2,
|
|
46
|
-
WEBRTC_ICE_CANDIDATE = 3
|
|
46
|
+
WEBRTC_ICE_CANDIDATE = 3,
|
|
47
|
+
WEBRTC_SDP_QUIT = 4
|
|
47
48
|
}
|
|
48
49
|
/** Response for an RPC function executed on the server. */
|
|
49
50
|
export interface RpcResponse {
|
|
@@ -251,6 +252,9 @@ export interface ApiUpdateChannelDescRequest {
|
|
|
251
252
|
category_id: string | undefined;
|
|
252
253
|
/** The app url of channel */
|
|
253
254
|
app_url: string | undefined;
|
|
255
|
+
e2ee?: number;
|
|
256
|
+
topic?: string;
|
|
257
|
+
age_restricted?: number;
|
|
254
258
|
}
|
|
255
259
|
/** Add users to a channel. */
|
|
256
260
|
export interface ApiAddChannelUsersRequest {
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -7047,9 +7047,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7047
7047
|
} else if (message.token_sent_event) {
|
|
7048
7048
|
this.ontokensent(message.token_sent_event);
|
|
7049
7049
|
} else if (message.message_button_clicked) {
|
|
7050
|
-
this.onmessagebuttonclicked(
|
|
7050
|
+
this.onmessagebuttonclicked(
|
|
7051
|
+
message.message_button_clicked
|
|
7052
|
+
);
|
|
7051
7053
|
} else if (message.webrtc_signaling_fwd) {
|
|
7052
|
-
this.onwebrtcsignalingfwd(
|
|
7054
|
+
this.onwebrtcsignalingfwd(
|
|
7055
|
+
message.webrtc_signaling_fwd
|
|
7056
|
+
);
|
|
7053
7057
|
} else if (message.list_activity) {
|
|
7054
7058
|
this.onactivityupdated(message.list_activity);
|
|
7055
7059
|
} else if (message.join_ptt_channel) {
|
|
@@ -7607,7 +7611,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7607
7611
|
forwardWebrtcSignaling(receiver_id, data_type, json_data, channel_id, caller_id) {
|
|
7608
7612
|
return __async(this, null, function* () {
|
|
7609
7613
|
const response = yield this.send({
|
|
7610
|
-
webrtc_signaling_fwd: {
|
|
7614
|
+
webrtc_signaling_fwd: {
|
|
7615
|
+
receiver_id,
|
|
7616
|
+
data_type,
|
|
7617
|
+
json_data,
|
|
7618
|
+
channel_id,
|
|
7619
|
+
caller_id
|
|
7620
|
+
}
|
|
7611
7621
|
});
|
|
7612
7622
|
return response.webrtc_signaling_fwd;
|
|
7613
7623
|
});
|
|
@@ -7615,7 +7625,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7615
7625
|
handleMessageButtonClick(message_id, channel_id, button_id, sender_id, user_id) {
|
|
7616
7626
|
return __async(this, null, function* () {
|
|
7617
7627
|
const response = yield this.send({
|
|
7618
|
-
message_button_clicked: {
|
|
7628
|
+
message_button_clicked: {
|
|
7629
|
+
message_id,
|
|
7630
|
+
channel_id,
|
|
7631
|
+
button_id,
|
|
7632
|
+
sender_id,
|
|
7633
|
+
user_id
|
|
7634
|
+
}
|
|
7619
7635
|
});
|
|
7620
7636
|
return response.webrtc_signaling_fwd;
|
|
7621
7637
|
});
|
|
@@ -7623,7 +7639,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7623
7639
|
joinPTTChannel(channelId, dataType, jsonData) {
|
|
7624
7640
|
return __async(this, null, function* () {
|
|
7625
7641
|
const response = yield this.send({
|
|
7626
|
-
join_ptt_channel: {
|
|
7642
|
+
join_ptt_channel: {
|
|
7643
|
+
channel_id: channelId,
|
|
7644
|
+
data_type: dataType,
|
|
7645
|
+
json_data: jsonData,
|
|
7646
|
+
receiver_id: ""
|
|
7647
|
+
}
|
|
7627
7648
|
});
|
|
7628
7649
|
return response.join_ptt_channel;
|
|
7629
7650
|
});
|
|
@@ -7631,7 +7652,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7631
7652
|
talkPTTChannel(channelId, dataType, jsonData, state) {
|
|
7632
7653
|
return __async(this, null, function* () {
|
|
7633
7654
|
const response = yield this.send({
|
|
7634
|
-
talk_ptt_channel: {
|
|
7655
|
+
talk_ptt_channel: {
|
|
7656
|
+
channel_id: channelId,
|
|
7657
|
+
data_type: dataType,
|
|
7658
|
+
json_data: jsonData,
|
|
7659
|
+
state
|
|
7660
|
+
}
|
|
7635
7661
|
});
|
|
7636
7662
|
return response.talk_ptt_channel;
|
|
7637
7663
|
});
|
|
@@ -7698,6 +7724,7 @@ var WebrtcSignalingType = /* @__PURE__ */ ((WebrtcSignalingType2) => {
|
|
|
7698
7724
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_OFFER"] = 1] = "WEBRTC_SDP_OFFER";
|
|
7699
7725
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_ANSWER"] = 2] = "WEBRTC_SDP_ANSWER";
|
|
7700
7726
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_ICE_CANDIDATE"] = 3] = "WEBRTC_ICE_CANDIDATE";
|
|
7727
|
+
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_QUIT"] = 4] = "WEBRTC_SDP_QUIT";
|
|
7701
7728
|
return WebrtcSignalingType2;
|
|
7702
7729
|
})(WebrtcSignalingType || {});
|
|
7703
7730
|
var Client = class {
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -7017,9 +7017,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7017
7017
|
} else if (message.token_sent_event) {
|
|
7018
7018
|
this.ontokensent(message.token_sent_event);
|
|
7019
7019
|
} else if (message.message_button_clicked) {
|
|
7020
|
-
this.onmessagebuttonclicked(
|
|
7020
|
+
this.onmessagebuttonclicked(
|
|
7021
|
+
message.message_button_clicked
|
|
7022
|
+
);
|
|
7021
7023
|
} else if (message.webrtc_signaling_fwd) {
|
|
7022
|
-
this.onwebrtcsignalingfwd(
|
|
7024
|
+
this.onwebrtcsignalingfwd(
|
|
7025
|
+
message.webrtc_signaling_fwd
|
|
7026
|
+
);
|
|
7023
7027
|
} else if (message.list_activity) {
|
|
7024
7028
|
this.onactivityupdated(message.list_activity);
|
|
7025
7029
|
} else if (message.join_ptt_channel) {
|
|
@@ -7577,7 +7581,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7577
7581
|
forwardWebrtcSignaling(receiver_id, data_type, json_data, channel_id, caller_id) {
|
|
7578
7582
|
return __async(this, null, function* () {
|
|
7579
7583
|
const response = yield this.send({
|
|
7580
|
-
webrtc_signaling_fwd: {
|
|
7584
|
+
webrtc_signaling_fwd: {
|
|
7585
|
+
receiver_id,
|
|
7586
|
+
data_type,
|
|
7587
|
+
json_data,
|
|
7588
|
+
channel_id,
|
|
7589
|
+
caller_id
|
|
7590
|
+
}
|
|
7581
7591
|
});
|
|
7582
7592
|
return response.webrtc_signaling_fwd;
|
|
7583
7593
|
});
|
|
@@ -7585,7 +7595,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7585
7595
|
handleMessageButtonClick(message_id, channel_id, button_id, sender_id, user_id) {
|
|
7586
7596
|
return __async(this, null, function* () {
|
|
7587
7597
|
const response = yield this.send({
|
|
7588
|
-
message_button_clicked: {
|
|
7598
|
+
message_button_clicked: {
|
|
7599
|
+
message_id,
|
|
7600
|
+
channel_id,
|
|
7601
|
+
button_id,
|
|
7602
|
+
sender_id,
|
|
7603
|
+
user_id
|
|
7604
|
+
}
|
|
7589
7605
|
});
|
|
7590
7606
|
return response.webrtc_signaling_fwd;
|
|
7591
7607
|
});
|
|
@@ -7593,7 +7609,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7593
7609
|
joinPTTChannel(channelId, dataType, jsonData) {
|
|
7594
7610
|
return __async(this, null, function* () {
|
|
7595
7611
|
const response = yield this.send({
|
|
7596
|
-
join_ptt_channel: {
|
|
7612
|
+
join_ptt_channel: {
|
|
7613
|
+
channel_id: channelId,
|
|
7614
|
+
data_type: dataType,
|
|
7615
|
+
json_data: jsonData,
|
|
7616
|
+
receiver_id: ""
|
|
7617
|
+
}
|
|
7597
7618
|
});
|
|
7598
7619
|
return response.join_ptt_channel;
|
|
7599
7620
|
});
|
|
@@ -7601,7 +7622,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
7601
7622
|
talkPTTChannel(channelId, dataType, jsonData, state) {
|
|
7602
7623
|
return __async(this, null, function* () {
|
|
7603
7624
|
const response = yield this.send({
|
|
7604
|
-
talk_ptt_channel: {
|
|
7625
|
+
talk_ptt_channel: {
|
|
7626
|
+
channel_id: channelId,
|
|
7627
|
+
data_type: dataType,
|
|
7628
|
+
json_data: jsonData,
|
|
7629
|
+
state
|
|
7630
|
+
}
|
|
7605
7631
|
});
|
|
7606
7632
|
return response.talk_ptt_channel;
|
|
7607
7633
|
});
|
|
@@ -7668,6 +7694,7 @@ var WebrtcSignalingType = /* @__PURE__ */ ((WebrtcSignalingType2) => {
|
|
|
7668
7694
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_OFFER"] = 1] = "WEBRTC_SDP_OFFER";
|
|
7669
7695
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_ANSWER"] = 2] = "WEBRTC_SDP_ANSWER";
|
|
7670
7696
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_ICE_CANDIDATE"] = 3] = "WEBRTC_ICE_CANDIDATE";
|
|
7697
|
+
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_QUIT"] = 4] = "WEBRTC_SDP_QUIT";
|
|
7671
7698
|
return WebrtcSignalingType2;
|
|
7672
7699
|
})(WebrtcSignalingType || {});
|
|
7673
7700
|
var Client = class {
|
package/dist/socket.d.ts
CHANGED
|
@@ -592,9 +592,14 @@ export interface WebrtcSignalingFwd {
|
|
|
592
592
|
caller_id: string;
|
|
593
593
|
}
|
|
594
594
|
export interface JoinPTTChannel {
|
|
595
|
+
/** channel id */
|
|
595
596
|
channel_id: string;
|
|
597
|
+
/** type offer, answer or candidate */
|
|
596
598
|
data_type: number;
|
|
599
|
+
/** offer */
|
|
597
600
|
json_data: string;
|
|
601
|
+
/** receiver id */
|
|
602
|
+
receiver_id: string;
|
|
598
603
|
}
|
|
599
604
|
export interface TalkPTTChannel {
|
|
600
605
|
channel_id: string;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
|
@@ -837,12 +837,14 @@ export interface WebrtcSignalingFwd {
|
|
|
837
837
|
}
|
|
838
838
|
|
|
839
839
|
export interface JoinPTTChannel {
|
|
840
|
-
|
|
840
|
+
/** channel id */
|
|
841
841
|
channel_id: string;
|
|
842
|
-
|
|
842
|
+
/** type offer, answer or candidate */
|
|
843
843
|
data_type: number;
|
|
844
|
-
|
|
844
|
+
/** offer */
|
|
845
845
|
json_data: string;
|
|
846
|
+
/** receiver id */
|
|
847
|
+
receiver_id: string;
|
|
846
848
|
}
|
|
847
849
|
|
|
848
850
|
export interface TalkPTTChannel {
|
|
@@ -1140,15 +1142,23 @@ export interface Socket {
|
|
|
1140
1142
|
type: number
|
|
1141
1143
|
): Promise<CheckNameExistedEvent>;
|
|
1142
1144
|
|
|
1143
|
-
handleMessageButtonClick: (
|
|
1145
|
+
handleMessageButtonClick: (
|
|
1146
|
+
message_id: string,
|
|
1144
1147
|
channel_id: string,
|
|
1145
1148
|
button_id: string,
|
|
1146
1149
|
sender_id: string,
|
|
1147
|
-
user_id: string
|
|
1150
|
+
user_id: string
|
|
1151
|
+
) => Promise<MessageButtonClicked>;
|
|
1148
1152
|
|
|
1149
1153
|
onmessagebuttonclicked: (event: MessageButtonClicked) => void;
|
|
1150
1154
|
|
|
1151
|
-
forwardWebrtcSignaling: (
|
|
1155
|
+
forwardWebrtcSignaling: (
|
|
1156
|
+
receiverId: string,
|
|
1157
|
+
dataType: number,
|
|
1158
|
+
jsonData: string,
|
|
1159
|
+
channelId: string,
|
|
1160
|
+
caller_id: string
|
|
1161
|
+
) => Promise<WebrtcSignalingFwd>;
|
|
1152
1162
|
|
|
1153
1163
|
onwebrtcsignalingfwd: (event: WebrtcSignalingFwd) => void;
|
|
1154
1164
|
|
|
@@ -1182,7 +1192,7 @@ export interface Socket {
|
|
|
1182
1192
|
|
|
1183
1193
|
onunmuteevent: (unmute_event: UnmuteEvent) => void;
|
|
1184
1194
|
|
|
1185
|
-
ontokensent: (token: ApiTokenSentEvent) => void;
|
|
1195
|
+
ontokensent: (token: ApiTokenSentEvent) => void;
|
|
1186
1196
|
|
|
1187
1197
|
onactivityupdated: (list_activity: ListActivity) => void;
|
|
1188
1198
|
|
|
@@ -1440,14 +1450,18 @@ export class DefaultSocket implements Socket {
|
|
|
1440
1450
|
} else if (message.token_sent_event) {
|
|
1441
1451
|
this.ontokensent(<ApiTokenSentEvent>message.token_sent_event);
|
|
1442
1452
|
} else if (message.message_button_clicked) {
|
|
1443
|
-
this.onmessagebuttonclicked(
|
|
1453
|
+
this.onmessagebuttonclicked(
|
|
1454
|
+
<MessageButtonClicked>message.message_button_clicked
|
|
1455
|
+
);
|
|
1444
1456
|
} else if (message.webrtc_signaling_fwd) {
|
|
1445
|
-
this.onwebrtcsignalingfwd(
|
|
1446
|
-
|
|
1457
|
+
this.onwebrtcsignalingfwd(
|
|
1458
|
+
<WebrtcSignalingFwd>message.webrtc_signaling_fwd
|
|
1459
|
+
);
|
|
1460
|
+
} else if (message.list_activity) {
|
|
1447
1461
|
this.onactivityupdated(<ListActivity>message.list_activity);
|
|
1448
|
-
} else if (message.join_ptt_channel){
|
|
1462
|
+
} else if (message.join_ptt_channel) {
|
|
1449
1463
|
this.onjoinpttchannel(<JoinPTTChannel>message.join_ptt_channel);
|
|
1450
|
-
} else if (message.talk_ptt_channel){
|
|
1464
|
+
} else if (message.talk_ptt_channel) {
|
|
1451
1465
|
this.ontalkpttchannel(<TalkPTTChannel>message.talk_ptt_channel);
|
|
1452
1466
|
} else {
|
|
1453
1467
|
if (this.verbose && window && window.console) {
|
|
@@ -2162,25 +2176,39 @@ export class DefaultSocket implements Socket {
|
|
|
2162
2176
|
}
|
|
2163
2177
|
|
|
2164
2178
|
async forwardWebrtcSignaling(
|
|
2165
|
-
receiver_id: string,
|
|
2166
|
-
data_type: number,
|
|
2179
|
+
receiver_id: string,
|
|
2180
|
+
data_type: number,
|
|
2167
2181
|
json_data: string,
|
|
2168
|
-
channel_id: string,
|
|
2169
|
-
caller_id: string
|
|
2182
|
+
channel_id: string,
|
|
2183
|
+
caller_id: string
|
|
2184
|
+
): Promise<WebrtcSignalingFwd> {
|
|
2170
2185
|
const response = await this.send({
|
|
2171
|
-
webrtc_signaling_fwd: {
|
|
2186
|
+
webrtc_signaling_fwd: {
|
|
2187
|
+
receiver_id: receiver_id,
|
|
2188
|
+
data_type: data_type,
|
|
2189
|
+
json_data: json_data,
|
|
2190
|
+
channel_id: channel_id,
|
|
2191
|
+
caller_id: caller_id,
|
|
2192
|
+
},
|
|
2172
2193
|
});
|
|
2173
2194
|
return response.webrtc_signaling_fwd;
|
|
2174
2195
|
}
|
|
2175
2196
|
|
|
2176
|
-
async handleMessageButtonClick
|
|
2197
|
+
async handleMessageButtonClick(
|
|
2177
2198
|
message_id: string,
|
|
2178
2199
|
channel_id: string,
|
|
2179
2200
|
button_id: string,
|
|
2180
2201
|
sender_id: string,
|
|
2181
|
-
user_id: string
|
|
2202
|
+
user_id: string
|
|
2203
|
+
): Promise<MessageButtonClicked> {
|
|
2182
2204
|
const response = await this.send({
|
|
2183
|
-
message_button_clicked: {
|
|
2205
|
+
message_button_clicked: {
|
|
2206
|
+
message_id: message_id,
|
|
2207
|
+
channel_id: channel_id,
|
|
2208
|
+
button_id: button_id,
|
|
2209
|
+
sender_id: sender_id,
|
|
2210
|
+
user_id: user_id,
|
|
2211
|
+
},
|
|
2184
2212
|
});
|
|
2185
2213
|
return response.webrtc_signaling_fwd;
|
|
2186
2214
|
}
|
|
@@ -2191,7 +2219,12 @@ export class DefaultSocket implements Socket {
|
|
|
2191
2219
|
jsonData: string
|
|
2192
2220
|
): Promise<JoinPTTChannel> {
|
|
2193
2221
|
const response = await this.send({
|
|
2194
|
-
join_ptt_channel: {
|
|
2222
|
+
join_ptt_channel: {
|
|
2223
|
+
channel_id: channelId,
|
|
2224
|
+
data_type: dataType,
|
|
2225
|
+
json_data: jsonData,
|
|
2226
|
+
receiver_id: "",
|
|
2227
|
+
},
|
|
2195
2228
|
});
|
|
2196
2229
|
return response.join_ptt_channel;
|
|
2197
2230
|
}
|
|
@@ -2203,7 +2236,12 @@ export class DefaultSocket implements Socket {
|
|
|
2203
2236
|
state: number
|
|
2204
2237
|
): Promise<TalkPTTChannel> {
|
|
2205
2238
|
const response = await this.send({
|
|
2206
|
-
talk_ptt_channel: {
|
|
2239
|
+
talk_ptt_channel: {
|
|
2240
|
+
channel_id: channelId,
|
|
2241
|
+
data_type: dataType,
|
|
2242
|
+
json_data: jsonData,
|
|
2243
|
+
state: state,
|
|
2244
|
+
},
|
|
2207
2245
|
});
|
|
2208
2246
|
return response.talk_ptt_channel;
|
|
2209
2247
|
}
|