node-nim 9.8.0 → 9.9.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.
Files changed (53) hide show
  1. package/README.md +19 -21
  2. package/dist/chatroom/chatroom.js.map +1 -1
  3. package/dist/nim/client.js.map +1 -1
  4. package/dist/nim/msglog.js.map +1 -1
  5. package/dist/nim/subscribe_event.js.map +1 -1
  6. package/dist/nim/super_team.js +3 -3
  7. package/dist/nim/super_team.js.map +1 -1
  8. package/dist/nim/team.js +29 -0
  9. package/dist/nim/team.js.map +1 -1
  10. package/dist/nim_def/msglog_def.js +7 -1
  11. package/dist/nim_def/msglog_def.js.map +1 -1
  12. package/dist/node-nim.js +4 -1
  13. package/dist/node-nim.js.map +1 -1
  14. package/dist/qchat/attachment.js +4 -15
  15. package/dist/qchat/attachment.js.map +1 -1
  16. package/dist/qchat/channel.js +42 -148
  17. package/dist/qchat/channel.js.map +1 -1
  18. package/dist/qchat/channel_category.js +24 -85
  19. package/dist/qchat/channel_category.js.map +1 -1
  20. package/dist/qchat/instance.js +6 -22
  21. package/dist/qchat/instance.js.map +1 -1
  22. package/dist/qchat/message.js +62 -120
  23. package/dist/qchat/message.js.map +1 -1
  24. package/dist/qchat/role.js +62 -218
  25. package/dist/qchat/role.js.map +1 -1
  26. package/dist/qchat/server.js +62 -218
  27. package/dist/qchat/server.js.map +1 -1
  28. package/dist/qchat/system_notification.js +8 -29
  29. package/dist/qchat/system_notification.js.map +1 -1
  30. package/dist/qchat_def/public_def.js +16 -3
  31. package/dist/qchat_def/public_def.js.map +1 -1
  32. package/node-nim-tester.js +40 -0
  33. package/package.json +13 -4
  34. package/script/download-sdk.js +78 -0
  35. package/script/exec-node-nim-tester.js +17 -0
  36. package/script/publish-to-netease-npm.js +28 -0
  37. package/types/chatroom/chatroom.d.ts +3 -3
  38. package/types/chatroom_def/chatroom_def.d.ts +3 -0
  39. package/types/nim/super_team.d.ts +1 -1
  40. package/types/nim/team.d.ts +18 -0
  41. package/types/nim_def/client_def.d.ts +1 -0
  42. package/types/nim_def/msglog_def.d.ts +6 -1
  43. package/types/nim_def/nos_def.d.ts +1 -1
  44. package/types/nim_def/super_team_def.d.ts +6 -2
  45. package/types/nim_def/team_def.d.ts +1 -0
  46. package/types/node-nim.d.ts +3 -0
  47. package/types/qchat/message.d.ts +13 -1
  48. package/types/qchat_def/channel_def.d.ts +2 -0
  49. package/types/qchat_def/instance_def.d.ts +4 -0
  50. package/types/qchat_def/message_def.d.ts +36 -3
  51. package/types/qchat_def/public_def.d.ts +15 -3
  52. package/types/qchat_def/system_notification_def.d.ts +3 -1
  53. package/script/download-sdk.mjs +0 -67
@@ -240,7 +240,9 @@ export declare enum NIMQChatPermissions {
240
240
  /** 服务器申请处理权限,Server */
241
241
  kPermissionServerHandleApply = 25,
242
242
  /** 申请邀请历史查看权限,有这个权限才可以查询server级别的申请/邀请记录,Server */
243
- kPermissionGetServerInviteApplyRecords = 26
243
+ kPermissionGetServerInviteApplyRecords = 26,
244
+ /** @ 身份组的权限,Server/Channel */
245
+ kPermissionMentionRole = 27
244
246
  }
245
247
  export declare enum NIMQChatRoleType {
246
248
  /** 未知 */
@@ -421,6 +423,14 @@ export declare enum NIMQChatInviteApplyRecordStatus {
421
423
  /** 过期 */
422
424
  kNIMQChatInviteApplyRecordStatusExpired = 6
423
425
  }
426
+ export declare enum NIMQChatSystemNotificationToType {
427
+ kNIMQChatSystemNotificationToTypeUnknown = 0 /**< 默认值,需要由用户修改,否则报错 10414 参数错误 */,
428
+ kNIMQChatSystemNotificationToTypeServer = 1 /**< 发送到 Server,server_id 必填 */,
429
+ kNIMQChatSystemNotificationToTypeChannel = 2 /**< 发送到 Channel,server_id 和 channel_id 必填 */,
430
+ kNIMQChatSystemNotificationToTypeServerAccids = 3 /**< 发送到 Server 中的指定用户,server_id 和 to_accids 必填 */,
431
+ kNIMQChatSystemNotificationToTypeChannelAccids = 4 /**<发送到 Channel 中的指定用户,server_id、channel_id 和 to_accids 必填 */,
432
+ kNIMQChatSystemNotificationToTypeAccids = 5 /**< 发送给指定用户,to_accids 必填 */
433
+ }
424
434
  export declare enum NIMQChatSystemNotificationType {
425
435
  /** 未知类型系统通知 */
426
436
  kNIMQChatSystemNotificationTypeUnkonwn = 0,
@@ -490,8 +500,10 @@ export declare enum NIMQChatSystemNotificationType {
490
500
  kNIMQChatSystemNotificationTypeServerEnterLeave = 32,
491
501
  /** 用户通过邀请码加入服务器 msg_data: NIMQChatSystemNotificationDataServerJoinByInviteCode */
492
502
  kNIMQChatSystemNotificationTypeServerJoinByInviteCode = 33,
493
- /** 频道对游客可见性变更 msg_data: NIMQChatSystemNotificationDataChannelGuestVisibilityChange*/
494
- NIMQChatSystemNotificationTypeChannelVisitorVisibilityChange = 34,
503
+ /** 频道对游客可见性变更 msg_data: NIMQChatSystemNotificationDataChannelGuestVisibilityChange */
504
+ kNIMQChatSystemNotificationTypeChannelVisitorVisibilityChange = 34,
505
+ /** 当前用户服务器成员信息对IM资料的联动变更 msg_data: NIMQChatSystemNotificationDataMyMemberInfoUpdated */
506
+ kNIMQChatSystemNotificationTypeMyMemberInfoUpdated = 35,
495
507
  /** 自定义系统通知 msg_data: NULL */
496
508
  kNIMQChatSystemNotificationTypeCustom = 100
497
509
  }
@@ -1,7 +1,9 @@
1
1
  import { QChatMessageUpdateInfo } from './message_def';
2
- import { NIMQChatSystemNotificationType, NIMQChatSystemNotificationStatus, QChatBaseResp } from './public_def';
2
+ import { NIMQChatSystemNotificationType, NIMQChatSystemNotificationStatus, QChatBaseResp, NIMQChatSystemNotificationToType } from './public_def';
3
3
  /** @interface QChatSystemNotification */
4
4
  export interface QChatSystemNotification {
5
+ /** 消息通知目标 */
6
+ to_type: NIMQChatSystemNotificationToType;
5
7
  /** 消息所属的server id */
6
8
  server_id?: number;
7
9
  /** 消息所属的channel id */
@@ -1,67 +0,0 @@
1
- import fetch from 'node-fetch'
2
- import compareVersions from 'compare-versions'
3
- import download from 'download'
4
- const arch = process.env.npm_config_arch || process.arch
5
- const platform = process.env.npm_config_platform || process.platform
6
- const sdk_group = 'message'
7
- const sdk_name = 'nim'
8
- const sdk_path = 'sdk'
9
- if (process.env.npm_config_ignore_download_sdk) {
10
- console.log('ignore download sdk')
11
- process.exit(0)
12
- }
13
- let sdk_url = process.env.npm_config_nim_sdk_url
14
- let sdk_version = process.env.npm_package_version.split('-')[0]
15
- if (process.env.npm_config_nim_sdk_version) {
16
- sdk_version = process.env.npm_config_nim_sdk_version
17
- }
18
- // fetch publish list
19
- fetch('https://admin.netease.im/public-service/free/publish/list')
20
- .then((res) => res.json())
21
- .then((publish_json) => {
22
- // get sdk list
23
- if (!sdk_url) {
24
- let latest_version = '0.0.0'
25
- let latest_sdk_url = ''
26
- Object.keys(publish_json.data[sdk_group]).forEach((temp) => {
27
- if (compareVersions.compare(latest_version, temp, '<')) {
28
- publish_json.data[sdk_group][temp].forEach((member) => {
29
- if (member.filename.includes(sdk_name) && member.filename.includes(platform) && member.filename.includes(arch)) {
30
- latest_version = temp
31
- latest_sdk_url = member.cdnlink
32
- }
33
- })
34
- }
35
- if (sdk_version === temp) {
36
- publish_json.data[sdk_group][temp].forEach((member) => {
37
- if (member.filename.includes(sdk_name) && member.filename.includes(platform) && member.filename.includes(arch)) {
38
- sdk_url = member.cdnlink
39
- }
40
- })
41
- }
42
- })
43
- if (!sdk_url || sdk_url.length === 0) {
44
- console.log(`${sdk_name} sdk version ${sdk_version} not found, use latest version ${latest_version}`)
45
- sdk_url = latest_sdk_url
46
- }
47
- console.log(`[node_pre_build] downloadSDK sdk_name:${sdk_name}, platform:${platform}, arch:${arch}`)
48
- }
49
- if (!sdk_url) {
50
- console.error(`[node_pre_build] downloadSDK sdk_name:${sdk_name}, platform:${platform}, arch:${arch} not found`)
51
- return
52
- }
53
- console.info(`[node_pre_build] Downloading prebuilt sdk from ${sdk_url} to ${sdk_path}`)
54
- // download sdk
55
- download(sdk_url, sdk_path, {
56
- extract: true,
57
- filter: (file) => {
58
- return !file.path.includes('._')
59
- }
60
- })
61
- .then(() => {
62
- console.info(`[node_pre_build] Downloading prebuilt sdk complete`)
63
- })
64
- .catch((err) => {
65
- console.error(`[node_pre_build] downloadSDK error:${err}`)
66
- })
67
- })