node-nim 7.8.3 → 9.1.0-rc.3

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 (131) hide show
  1. package/README.md +70 -23
  2. package/download-sdk.mjs +59 -0
  3. package/js/api/client.js +103 -36
  4. package/js/api/client.js.map +1 -0
  5. package/js/api/data_sync.js +8 -8
  6. package/js/api/data_sync.js.map +1 -0
  7. package/js/api/friend.js +75 -12
  8. package/js/api/friend.js.map +1 -0
  9. package/js/api/global.js +66 -14
  10. package/js/api/global.js.map +1 -0
  11. package/js/api/msglog.js +398 -47
  12. package/js/api/msglog.js.map +1 -0
  13. package/js/api/nos.js +114 -24
  14. package/js/api/nos.js.map +1 -0
  15. package/js/api/online_session.js +39 -13
  16. package/js/api/online_session.js.map +1 -0
  17. package/js/api/pass_through_proxy.js +18 -5
  18. package/js/api/pass_through_proxy.js.map +1 -0
  19. package/js/api/plugin.js +40 -4
  20. package/js/api/plugin.js.map +1 -0
  21. package/js/api/session.js +192 -25
  22. package/js/api/session.js.map +1 -0
  23. package/js/api/subscribe_event.js +75 -11
  24. package/js/api/subscribe_event.js.map +1 -0
  25. package/js/api/super_team.js +332 -68
  26. package/js/api/super_team.js.map +1 -0
  27. package/js/api/sysmsg.js +94 -17
  28. package/js/api/sysmsg.js.map +1 -0
  29. package/js/api/talk.js +50 -29
  30. package/js/api/talk.js.map +1 -0
  31. package/js/api/talkex.js +72 -28
  32. package/js/api/talkex.js.map +1 -0
  33. package/js/api/team.js +423 -25
  34. package/js/api/team.js.map +1 -0
  35. package/js/api/tool.js +72 -9
  36. package/js/api/tool.js.map +1 -0
  37. package/js/api/user.js +97 -13
  38. package/js/api/user.js.map +1 -0
  39. package/js/{api/rescode_def.js → def/client_def.js} +74 -10
  40. package/js/def/client_def.js.map +1 -0
  41. package/js/{api → def}/data_sync_def.js +1 -2
  42. package/js/def/data_sync_def.js.map +1 -0
  43. package/js/{api → def}/doc_trans_def.js +1 -2
  44. package/js/def/doc_trans_def.js.map +1 -0
  45. package/js/{api → def}/friend_def.js +2 -2
  46. package/js/def/friend_def.js.map +1 -0
  47. package/js/{api → def}/global_def.js +1 -1
  48. package/js/def/global_def.js.map +1 -0
  49. package/js/{api → def}/msglog_def.js +14 -8
  50. package/js/def/msglog_def.js.map +1 -0
  51. package/js/{api → def}/nos_def.js +1 -0
  52. package/js/def/nos_def.js.map +1 -0
  53. package/js/{api → def}/online_session_def.js +1 -0
  54. package/js/def/online_session_def.js.map +1 -0
  55. package/js/{api → def}/pass_through_proxy_def.js +1 -1
  56. package/js/def/pass_through_proxy_def.js.map +1 -0
  57. package/js/{api → def}/plugin_def.js +1 -0
  58. package/js/def/plugin_def.js.map +1 -0
  59. package/js/{api/session.def.js → def/session_def.js} +1 -0
  60. package/js/def/session_def.js.map +1 -0
  61. package/js/{api → def}/subscribe_event_def.js +2 -1
  62. package/js/def/subscribe_event_def.js.map +1 -0
  63. package/js/{api → def}/super_team_def.js +9 -6
  64. package/js/def/super_team_def.js.map +1 -0
  65. package/js/{api → def}/sysmsg_def.js +11 -1
  66. package/js/def/sysmsg_def.js.map +1 -0
  67. package/js/{api → def}/talk_def.js +1 -0
  68. package/js/def/talk_def.js.map +1 -0
  69. package/js/{api → def}/talkex_def.js +1 -0
  70. package/js/def/talkex_def.js.map +1 -0
  71. package/js/{api → def}/team_def.js +3 -2
  72. package/js/def/team_def.js.map +1 -0
  73. package/js/{api → def}/tool_def.js +1 -1
  74. package/js/def/tool_def.js.map +1 -0
  75. package/js/{api → def}/user_def.js +2 -1
  76. package/js/def/user_def.js.map +1 -0
  77. package/js/loader.js +30 -0
  78. package/js/loader.js.map +1 -0
  79. package/js/nim.js +38 -44
  80. package/js/nim.js.map +1 -0
  81. package/package.json +37 -24
  82. package/types/api/client.d.ts +124 -0
  83. package/types/api/data_sync.d.ts +13 -0
  84. package/types/api/friend.d.ts +82 -0
  85. package/types/api/global.d.ts +69 -0
  86. package/types/api/msglog.d.ts +388 -0
  87. package/types/api/nos.d.ts +118 -0
  88. package/types/api/online_session.d.ts +44 -0
  89. package/types/api/pass_through_proxy.d.ts +24 -0
  90. package/types/api/plugin.d.ts +37 -0
  91. package/types/api/session.d.ts +212 -0
  92. package/types/api/subscribe_event.d.ts +87 -0
  93. package/types/api/super_team.d.ts +332 -0
  94. package/types/api/sysmsg.d.ts +104 -0
  95. package/types/api/talk.d.ts +69 -0
  96. package/types/api/talkex.d.ts +93 -0
  97. package/types/api/team.d.ts +442 -0
  98. package/types/api/tool.d.ts +75 -0
  99. package/types/api/user.d.ts +111 -0
  100. package/types/def/client_def.d.ts +276 -0
  101. package/types/def/data_sync_def.d.ts +19 -0
  102. package/types/def/doc_trans_def.d.ts +11 -0
  103. package/types/def/friend_def.d.ts +65 -0
  104. package/types/def/global_def.d.ts +69 -0
  105. package/types/def/msglog_def.d.ts +328 -0
  106. package/types/def/nos_def.d.ts +71 -0
  107. package/types/def/online_session_def.d.ts +34 -0
  108. package/types/def/pass_through_proxy_def.d.ts +12 -0
  109. package/types/def/plugin_def.d.ts +7 -0
  110. package/types/def/session_def.d.ts +113 -0
  111. package/types/def/subscribe_event_def.d.ts +82 -0
  112. package/types/def/super_team_def.d.ts +133 -0
  113. package/types/def/sysmsg_def.d.ts +84 -0
  114. package/types/def/talk_def.d.ts +48 -0
  115. package/types/def/talkex_def.d.ts +111 -0
  116. package/types/def/team_def.d.ts +153 -0
  117. package/types/def/tool_def.d.ts +27 -0
  118. package/types/def/user_def.d.ts +58 -0
  119. package/types/loader.d.ts +2 -0
  120. package/types/nim.d.ts +18 -0
  121. package/js/api/client_def.js +0 -58
  122. package/js/api/nim.js +0 -13
  123. package/js/api/rts.js +0 -68
  124. package/js/api/rts_def.js +0 -15
  125. package/js/api/signaling.js +0 -62
  126. package/js/api/signaling_def.js +0 -20
  127. package/just-task.js +0 -154
  128. package/scripts/build_addon.js +0 -56
  129. package/scripts/build_wrapper.js +0 -45
  130. package/scripts/fetch_wrapper.js +0 -45
  131. package/scripts/pack_addon.js +0 -41
@@ -0,0 +1 @@
1
+ {"version":3,"file":"talk_def.js","sourceRoot":"","sources":["../../ts/def/talk_def.ts"],"names":[],"mappings":""}
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=talkex_def.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"talkex_def.js","sourceRoot":"","sources":["../../ts/def/talkex_def.ts"],"names":[],"mappings":""}
@@ -25,7 +25,7 @@ var NIMTeamUpdateCustomMode;
25
25
  NIMTeamUpdateCustomMode[NIMTeamUpdateCustomMode["kNIMTeamUpdateCustomModeManager"] = 0] = "kNIMTeamUpdateCustomModeManager";
26
26
  NIMTeamUpdateCustomMode[NIMTeamUpdateCustomMode["kNIMTeamUpdateCustomModeEveryone"] = 1] = "kNIMTeamUpdateCustomModeEveryone";
27
27
  })(NIMTeamUpdateCustomMode = exports.NIMTeamUpdateCustomMode || (exports.NIMTeamUpdateCustomMode = {}));
28
- /** @enum NIMTeamMuteType 群信息kNIMTeamInfoKeyMuteType的配置定义 */
28
+ /** @enum NIMTeamMuteType 群信息kTeamInfoKeyMuteType的配置定义 */
29
29
  var NIMTeamMuteType;
30
30
  (function (NIMTeamMuteType) {
31
31
  NIMTeamMuteType[NIMTeamMuteType["kNIMTeamMuteTypeNone"] = 0] = "kNIMTeamMuteTypeNone";
@@ -65,5 +65,6 @@ var NIMTeamQueryType;
65
65
  (function (NIMTeamQueryType) {
66
66
  NIMTeamQueryType[NIMTeamQueryType["kNIMTeamQueryDefault"] = 0] = "kNIMTeamQueryDefault";
67
67
  NIMTeamQueryType[NIMTeamQueryType["kNIMTeamQueryByTeamId"] = 1] = "kNIMTeamQueryByTeamId";
68
- NIMTeamQueryType[NIMTeamQueryType["kNIMTeamQueryByTeamName"] = 2] = "kNIMTeamQueryByTeamName"; /**< 仅匹配群组名称 */
68
+ NIMTeamQueryType[NIMTeamQueryType["kNIMTeamQueryByTeamName"] = 2] = "kNIMTeamQueryByTeamName"; /** < 仅匹配群组名称 */
69
69
  })(NIMTeamQueryType = exports.NIMTeamQueryType || (exports.NIMTeamQueryType = {}));
70
+ //# sourceMappingURL=team_def.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team_def.js","sourceRoot":"","sources":["../../ts/def/team_def.ts"],"names":[],"mappings":";;;AAGA,yCAAyC;AACzC,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC3B,+GAAiC,CAAA;IACjC,qHAAoC,CAAA;AACxC,CAAC,EAHW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAG9B;AAED,wCAAwC;AACxC,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IACzB,mGAA6B,CAAA;IAC7B,qGAA8B,CAAA;AAClC,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B;AAED,2CAA2C;AAC3C,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC7B,mHAAiC,CAAA;IACjC,qHAAkC,CAAA;AACtC,CAAC,EAHW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAGhC;AAED,gDAAgD;AAChD,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IAC/B,2HAAmC,CAAA;IACnC,6HAAoC,CAAA;AACxC,CAAC,EAHW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAGlC;AAED,yDAAyD;AACzD,IAAY,eAIX;AAJD,WAAY,eAAe;IACvB,qFAAwB,CAAA;IACxB,+FAA6B,CAAA;IAC7B,2FAA2B,CAAA;AAC/B,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AAED,uEAAuE;AACvE,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC7B,qHAAkC,CAAA;IAClC,yHAAoC,CAAA;IACpC,uHAAmC,CAAA;AACvC,CAAC,EAJW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAIhC;AAED,6BAA6B;AAC7B,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,yEAAsB,CAAA;IACtB,6EAAwB,CAAA;AAC5B,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB;AAED,kCAAkC;AAClC,IAAY,eAMX;AAND,WAAY,eAAe;IACvB,uFAAyB,CAAA;IACzB,2FAA2B,CAAA;IAC3B,2FAA2B,CAAA;IAC3B,uFAAyB,CAAA;IACzB,6GAAqC,CAAA;AACzC,CAAC,EANW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAM1B;AAED,oCAAoC;AACpC,IAAY,eAIX;AAJD,WAAY,eAAe;IACvB,yFAA0B,CAAA;IAC1B,6FAA4B,CAAA;IAC5B,+FAA6B,CAAA;AACjC,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AAED,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IACxB,uFAAwB,CAAA;IACxB,yFAAyB,CAAA;IACzB,6FAA2B,CAAA,CAAE,gBAAgB;AACjD,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B"}
@@ -9,4 +9,4 @@ var NIMAppDataType;
9
9
  NIMAppDataType[NIMAppDataType["kNIMAppDataTypeAudio"] = 2] = "kNIMAppDataTypeAudio";
10
10
  NIMAppDataType[NIMAppDataType["kNIMAppDataTypeVideo"] = 3] = "kNIMAppDataTypeVideo";
11
11
  })(NIMAppDataType = exports.NIMAppDataType || (exports.NIMAppDataType = {}));
12
- ;
12
+ //# sourceMappingURL=tool_def.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool_def.js","sourceRoot":"","sources":["../../ts/def/tool_def.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,IAAY,cAKX;AALD,WAAY,cAAc;IACtB,uGAAkC,CAAA;IAClC,mFAAwB,CAAA;IACxB,mFAAwB,CAAA;IACxB,mFAAwB,CAAA;AAC5B,CAAC,EALW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAKzB"}
@@ -13,10 +13,11 @@ var NIMUserQueryType;
13
13
  (function (NIMUserQueryType) {
14
14
  NIMUserQueryType[NIMUserQueryType["kNIMUserQueryDefault"] = 0] = "kNIMUserQueryDefault";
15
15
  NIMUserQueryType[NIMUserQueryType["kNIMUserQueryByAccId"] = 1] = "kNIMUserQueryByAccId";
16
- NIMUserQueryType[NIMUserQueryType["kNIMUserQueryByNickname"] = 2] = "kNIMUserQueryByNickname"; /**< 仅匹配用户昵称 */
16
+ NIMUserQueryType[NIMUserQueryType["kNIMUserQueryByNickname"] = 2] = "kNIMUserQueryByNickname"; /** < 仅匹配用户昵称 */
17
17
  })(NIMUserQueryType = exports.NIMUserQueryType || (exports.NIMUserQueryType = {}));
18
18
  var NINPushType;
19
19
  (function (NINPushType) {
20
20
  NINPushType[NINPushType["kNIMPushTypeDefault"] = 0] = "kNIMPushTypeDefault";
21
21
  NINPushType[NINPushType["kNIMPushTypePushKit"] = 1] = "kNIMPushTypePushKit";
22
22
  })(NINPushType = exports.NINPushType || (exports.NINPushType = {}));
23
+ //# sourceMappingURL=user_def.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user_def.js","sourceRoot":"","sources":["../../ts/def/user_def.ts"],"names":[],"mappings":";;;AAAA,8DAA8D;AAC9D,IAAY,oCAIX;AAJD,WAAY,oCAAoC;IAC5C,mLAAkD,CAAA;IAClD,iLAAiD,CAAA;IACjD,yMAA6D,CAAA;AACjE,CAAC,EAJW,oCAAoC,GAApC,4CAAoC,KAApC,4CAAoC,QAI/C;AAED,wCAAwC;AACxC,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IACxB,uFAAwB,CAAA;IACxB,uFAAwB,CAAA;IACxB,6FAA2B,CAAA,CAAE,gBAAgB;AACjD,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AAED,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,2EAAuB,CAAA;IACvB,2EAAuB,CAAA;AAC3B,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB"}
package/js/loader.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_1 = __importDefault(require("fs"));
7
+ const path_1 = __importDefault(require("path"));
8
+ var sdk_path = "";
9
+ var test_sdk_path = "";
10
+ // Add the compiled product path to the environment variable,
11
+ // so that the third party does not need to copy the
12
+ // dynamic library separately to the program directory when importing.
13
+ if (process.platform === 'win32') {
14
+ sdk_path = path_1.default.join(__dirname, '../sdk/bin');
15
+ test_sdk_path = path_1.default.join(__dirname, '../../../bin');
16
+ process.env.PATH = `${sdk_path};${test_sdk_path};${process.env.PATH}`;
17
+ }
18
+ else if (process.platform === 'darwin') {
19
+ sdk_path = path_1.default.join(__dirname, '../sdk/lib');
20
+ test_sdk_path = path_1.default.join(__dirname, '../../../lib');
21
+ }
22
+ let node_nim_path;
23
+ if (fs_1.default.existsSync(sdk_path)) {
24
+ node_nim_path = path_1.default.join(sdk_path, 'node-nim');
25
+ }
26
+ else {
27
+ node_nim_path = path_1.default.join(test_sdk_path, 'node-nim');
28
+ }
29
+ exports.default = require(node_nim_path);
30
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../ts/loader.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,IAAI,QAAQ,GAAU,EAAE,CAAC;AACzB,IAAI,aAAa,GAAU,EAAE,CAAC;AAE9B,6DAA6D;AAC7D,oDAAoD;AACpD,sEAAsE;AACtE,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAC9B,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAC9C,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,QAAQ,IAAI,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;CACzE;KAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;IACtC,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAC9C,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;CACxD;AACD,IAAI,aAAa,CAAC;AAClB,IAAI,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;IACzB,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;CACnD;KAAM;IACH,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;CACxD;AAED,kBAAe,OAAO,CAAC,aAAa,CAAC,CAAC"}
package/js/nim.js CHANGED
@@ -1,46 +1,40 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const client_1 = __importDefault(require("./api/client"));
7
- const data_sync_1 = __importDefault(require("./api/data_sync"));
8
- const friend_1 = __importDefault(require("./api/friend"));
9
- const global_1 = __importDefault(require("./api/global"));
10
- const msglog_1 = __importDefault(require("./api/msglog"));
11
- const nos_1 = __importDefault(require("./api/nos"));
12
- const online_session_1 = __importDefault(require("./api/online_session"));
13
- const pass_through_proxy_1 = __importDefault(require("./api/pass_through_proxy"));
14
- const session_1 = __importDefault(require("./api/session"));
15
- const subscribe_event_1 = __importDefault(require("./api/subscribe_event"));
16
- const super_team_1 = __importDefault(require("./api/super_team"));
17
- const sysmsg_1 = __importDefault(require("./api/sysmsg"));
18
- const talk_1 = __importDefault(require("./api/talk"));
19
- const team_1 = __importDefault(require("./api/team"));
20
- const tool_1 = __importDefault(require("./api/tool"));
21
- const user_1 = __importDefault(require("./api/user"));
22
- const rts_1 = __importDefault(require("./api/rts"));
23
- const signaling_1 = __importDefault(require("./api/signaling"));
24
- const talkex_1 = __importDefault(require("./api/talkex"));
25
- const NIMSDK = {
26
- NIMClient: client_1.default,
27
- NIMDataSync: data_sync_1.default,
28
- NIMFriend: friend_1.default,
29
- NIMGlobal: global_1.default,
30
- NIMMsgLog: msglog_1.default,
31
- NIMNOS: nos_1.default,
32
- NIMOnlineSession: online_session_1.default,
33
- NIMPassThroughProxy: pass_through_proxy_1.default,
34
- NIMSession: session_1.default,
35
- NIMSubscribeEvent: subscribe_event_1.default,
36
- NIMSuperTeam: super_team_1.default,
37
- NIMSysMsg: sysmsg_1.default,
38
- NIMTalk: talk_1.default,
39
- NIMTeam: team_1.default,
40
- NIMTool: tool_1.default,
41
- NIMUser: user_1.default,
42
- NIMRts: rts_1.default,
43
- NIMSignaling: signaling_1.default,
44
- NIMTalkEx: talkex_1.default
45
- };
46
- exports.default = NIMSDK;
3
+ exports.NIMTalkEx = exports.NIMPlugin = exports.NIMUser = exports.NIMTool = exports.NIMTeam = exports.NIMTalk = exports.NIMSysMsg = exports.NIMSuperTeam = exports.NIMSubscribeEvent = exports.NIMSession = exports.NIMPassThroughProxy = exports.NIMOnlineSession = exports.NIMNOS = exports.NIMMsgLog = exports.NIMGlobal = exports.NIMFriend = exports.NIMDataSync = exports.NIMClient = void 0;
4
+ var client_1 = require("./api/client");
5
+ Object.defineProperty(exports, "NIMClient", { enumerable: true, get: function () { return client_1.NIMClient; } });
6
+ var data_sync_1 = require("./api/data_sync");
7
+ Object.defineProperty(exports, "NIMDataSync", { enumerable: true, get: function () { return data_sync_1.NIMDataSync; } });
8
+ var friend_1 = require("./api/friend");
9
+ Object.defineProperty(exports, "NIMFriend", { enumerable: true, get: function () { return friend_1.NIMFriend; } });
10
+ var global_1 = require("./api/global");
11
+ Object.defineProperty(exports, "NIMGlobal", { enumerable: true, get: function () { return global_1.NIMGlobal; } });
12
+ var msglog_1 = require("./api/msglog");
13
+ Object.defineProperty(exports, "NIMMsgLog", { enumerable: true, get: function () { return msglog_1.NIMMsgLog; } });
14
+ var nos_1 = require("./api/nos");
15
+ Object.defineProperty(exports, "NIMNOS", { enumerable: true, get: function () { return nos_1.NIMNOS; } });
16
+ var online_session_1 = require("./api/online_session");
17
+ Object.defineProperty(exports, "NIMOnlineSession", { enumerable: true, get: function () { return online_session_1.NIMOnlineSession; } });
18
+ var pass_through_proxy_1 = require("./api/pass_through_proxy");
19
+ Object.defineProperty(exports, "NIMPassThroughProxy", { enumerable: true, get: function () { return pass_through_proxy_1.NIMPassThroughProxy; } });
20
+ var session_1 = require("./api/session");
21
+ Object.defineProperty(exports, "NIMSession", { enumerable: true, get: function () { return session_1.NIMSession; } });
22
+ var subscribe_event_1 = require("./api/subscribe_event");
23
+ Object.defineProperty(exports, "NIMSubscribeEvent", { enumerable: true, get: function () { return subscribe_event_1.NIMSubscribeEvent; } });
24
+ var super_team_1 = require("./api/super_team");
25
+ Object.defineProperty(exports, "NIMSuperTeam", { enumerable: true, get: function () { return super_team_1.NIMSuperTeam; } });
26
+ var sysmsg_1 = require("./api/sysmsg");
27
+ Object.defineProperty(exports, "NIMSysMsg", { enumerable: true, get: function () { return sysmsg_1.NIMSysMsg; } });
28
+ var talk_1 = require("./api/talk");
29
+ Object.defineProperty(exports, "NIMTalk", { enumerable: true, get: function () { return talk_1.NIMTalk; } });
30
+ var team_1 = require("./api/team");
31
+ Object.defineProperty(exports, "NIMTeam", { enumerable: true, get: function () { return team_1.NIMTeam; } });
32
+ var tool_1 = require("./api/tool");
33
+ Object.defineProperty(exports, "NIMTool", { enumerable: true, get: function () { return tool_1.NIMTool; } });
34
+ var user_1 = require("./api/user");
35
+ Object.defineProperty(exports, "NIMUser", { enumerable: true, get: function () { return user_1.NIMUser; } });
36
+ var plugin_1 = require("./api/plugin");
37
+ Object.defineProperty(exports, "NIMPlugin", { enumerable: true, get: function () { return plugin_1.NIMPlugin; } });
38
+ var talkex_1 = require("./api/talkex");
39
+ Object.defineProperty(exports, "NIMTalkEx", { enumerable: true, get: function () { return talkex_1.NIMTalkEx; } });
40
+ //# sourceMappingURL=nim.js.map
package/js/nim.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nim.js","sourceRoot":"","sources":["../ts/nim.ts"],"names":[],"mappings":";;;AAAA,uCAAyC;AAAhC,mGAAA,SAAS,OAAA;AAClB,6CAA8C;AAArC,wGAAA,WAAW,OAAA;AACpB,uCAAyC;AAAhC,mGAAA,SAAS,OAAA;AAClB,uCAAyC;AAAhC,mGAAA,SAAS,OAAA;AAClB,uCAAyC;AAAhC,mGAAA,SAAS,OAAA;AAClB,iCAAmC;AAA1B,6FAAA,MAAM,OAAA;AACf,uDAAwD;AAA/C,kHAAA,gBAAgB,OAAA;AACzB,+DAA+D;AAAtD,yHAAA,mBAAmB,OAAA;AAC5B,yCAA2C;AAAlC,qGAAA,UAAU,OAAA;AACnB,yDAA0D;AAAjD,oHAAA,iBAAiB,OAAA;AAC1B,+CAAgD;AAAvC,0GAAA,YAAY,OAAA;AACrB,uCAAyC;AAAhC,mGAAA,SAAS,OAAA;AAClB,mCAAqC;AAA5B,+FAAA,OAAO,OAAA;AAChB,mCAAqC;AAA5B,+FAAA,OAAO,OAAA;AAChB,mCAAqC;AAA5B,+FAAA,OAAO,OAAA;AAChB,mCAAqC;AAA5B,+FAAA,OAAO,OAAA;AAChB,uCAAyC;AAAhC,mGAAA,SAAS,OAAA;AAClB,uCAAyC;AAAhC,mGAAA,SAAS,OAAA"}
package/package.json CHANGED
@@ -1,49 +1,62 @@
1
1
  {
2
2
  "name": "node-nim",
3
- "version": "7.8.3",
3
+ "version": "9.1.0-rc.3",
4
4
  "description": "NetEase IM nodejs wrapper based on NetEase IM C++ SDK",
5
5
  "main": "js/nim.js",
6
6
  "types": "types/nim.d.ts",
7
- "author": "Dylan",
7
+ "author": "Netease",
8
8
  "license": "ISC",
9
+ "homepage": "https://github.com/netease-im/node-nim",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git://github.com/netease-im/node-nim.git"
13
+ },
9
14
  "scripts": {
10
- "test": "mocha test -slow 200 -timeout 5000",
11
- "install": "just install",
15
+ "coverage": "nyc mocha test/test_all.js -slow 200 -timeout 10000",
12
16
  "build:ts": "rimraf ./js && rimraf ./types && tsc",
13
- "prepare": "npm run build:ts"
17
+ "build:doc": "typedoc",
18
+ "prepublish": "npm run build:ts",
19
+ "install": "npm run download:sdk",
20
+ "download:sdk": "node download-sdk.mjs"
21
+ },
22
+ "nyc": {
23
+ "cache": false,
24
+ "reporter": [
25
+ "lcov"
26
+ ]
14
27
  },
15
28
  "dependencies": {
16
- "bindings": "^1.5.0",
17
29
  "download": "^8.0.0",
18
- "extract-zip": "^2.0.1",
19
- "just-task": "^1.4.1",
20
- "node-gyp": "^8.1.0",
21
- "shelljs": "^0.8.4",
22
- "tar": "^6.1.0"
30
+ "node-fetch": "^2.6.5",
31
+ "compare-versions": "^4.1.3"
23
32
  },
24
33
  "devDependencies": {
25
- "eslint": "^7.31.0",
26
- "eslint-config-standard": "^16.0.3",
27
- "eslint-plugin-import": "^2.23.4",
28
- "eslint-plugin-node": "^11.1.0",
29
- "eslint-plugin-promise": "^5.1.0",
30
- "eslint-plugin-standard": "^5.0.0",
31
- "mocha": "^8.4.0",
32
- "typescript": "^4.3.5",
33
- "typescript-eslint": "0.0.1-alpha.0"
34
+ "@types/node": "^16.10.5",
35
+ "@typescript-eslint/eslint-plugin": "^5.17.0",
36
+ "@typescript-eslint/parser": "^5.17.0",
37
+ "bluebird": "^3.7.2",
38
+ "cmake-js": "^6.3.0",
39
+ "eslint": "^7.32.0",
40
+ "mocha": "^9.1.1",
41
+ "node-addon-api": "^4.3.0",
42
+ "nyc": "^15.1.0",
43
+ "typedoc": "^0.22.13",
44
+ "typedoc-github-wiki-theme": "^1.0.0",
45
+ "typedoc-plugin-markdown": "^3.11.14",
46
+ "typescript": "^4.3.5"
34
47
  },
35
48
  "keywords": [
36
49
  "netease",
37
50
  "nim",
38
- "chatroom",
39
51
  "im sdk",
40
52
  "nim sdk",
41
53
  "nim node",
42
54
  "nim electron"
43
55
  ],
44
56
  "files": [
45
- "js",
46
- "scripts",
47
- "just-task.js"
57
+ "js/",
58
+ "types/",
59
+ "package.json",
60
+ "download-sdk.mjs"
48
61
  ]
49
62
  }
@@ -0,0 +1,124 @@
1
+ /// <reference types="node" />
2
+ import { NIMClientAPI, GetCurrentServerTimeCallback, LoginCallback, LogoutCallback, MultiportPushConfigCallback, NIMLoginState, NIMLogoutType, SDKConfig } from '../def/client_def';
3
+ import ev from 'events';
4
+ export declare interface NIMClient {
5
+ on(event: 'disconnect', listener: () => void): this;
6
+ on(event: 'multispotLogin', listener: () => void): this;
7
+ on(event: 'syncMultiportPushConfig', listener: () => void): this;
8
+ on(event: 'kickout', listener: () => void): this;
9
+ on(event: 'kickOtherClient', listener: () => void): this;
10
+ on(event: 'relogin', listener: () => void): this;
11
+ once(event: 'disconnect', listener: () => void): this;
12
+ once(event: 'multispotLogin', listener: () => void): this;
13
+ once(event: 'syncMultiportPushConfig', listener: () => void): this;
14
+ once(event: 'kickout', listener: () => void): this;
15
+ once(event: 'kickOtherClient', listener: () => void): this;
16
+ once(event: 'relogin', listener: () => void): this;
17
+ }
18
+ export declare class NIMClient extends ev.EventEmitter {
19
+ client: NIMClientAPI;
20
+ constructor();
21
+ /** NIM SDK初始化
22
+ * @param appKey 应用注册的APP KEY
23
+ * @param appDataDir 推荐用户目录放置在系统目录{AppData\Local},默认只需要传入目录名,SDK会默认在系统目录下创建该级用户目录。如果要使用其他自定义路径,需传入绝对路径路径,并确保该目录有正确的读写权限。
24
+ * @param appInstallDir SDK动态库所在的目录全路径(如果传入为空,则按照默认规则搜索该动态库)
25
+ * @param config 初始化参数
26
+ * @return bool 返回值true: 成功, false: 失败
27
+ */
28
+ init(appKey: string, appDataDir: string, appInstallDir: string, config: SDKConfig): boolean;
29
+ /** 注册全局回调 */
30
+ initEventHandlers(): void;
31
+ /** NIM客户端登录
32
+ * @param appKey
33
+ * @param account 帐号
34
+ * @param password 密码
35
+ * @param cb 登录流程的回调函数
36
+ * @param jsonExtension json扩展参数(v5.7.0 项目增加自定义参数字段)
37
+ * @return bool 检查参数如果不符合要求则返回失败
38
+ * @note
39
+ * <pre>
40
+ * 200:成功
41
+ * 302:账号或密码错误
42
+ * 403:禁止操作
43
+ * 408:请求超时
44
+ * 414:参数错误
45
+ * 415:网络连接出现错误
46
+ * 416:频率超限
47
+ * 422:账号被禁用
48
+ * </pre>
49
+ */
50
+ login(appKey: string, account: string, password: string, cb: LoginCallback, jsonExtension: string): boolean;
51
+ /** NIM客户端注销/退出
52
+ * @param logoutType Logout操作类型,其定义见nim_client_def.h
53
+ * @param cb 注销/退出的回调函数
54
+ * @param jsonExtension json扩展参数(备用,目前不需要)
55
+ * @return void 无返回值
56
+ * @note
57
+ * <pre>
58
+ * 200:成功
59
+ * 500:未知错误
60
+ * </pre>
61
+ */
62
+ logout(logoutType: NIMLogoutType, cb: LogoutCallback, jsonExtension: string): void;
63
+ /** NIM SDK清理
64
+ * @param jsonExtension json扩展参数(备用,目前不需要)
65
+ * @return void 无返回值
66
+ */
67
+ cleanup(jsonExtension: string): void;
68
+ /** 获取SDK配置
69
+ * @return SDKConfig 返回值SDKConfig的引用 const类型,不可试图修改
70
+ */
71
+ getSDKConfig(): SDKConfig;
72
+ /** 获取客户端登录状态
73
+ * @param jsonExtension json扩展参数(备用,目前不需要)
74
+ * @return NIMLoginState 登录状态
75
+ */
76
+ getLoginState(jsonExtension: string): NIMLoginState;
77
+ /** NIM客户端手动重连(注意 APP需要统一处理自动重连/手动重连的回调,因为如果处于某次自动重连的过程中调用手动重连接口,不起作用!)
78
+ * @param jsonExtension json扩展参数(备用,目前不需要)
79
+ * @return void 无返回值
80
+ */
81
+ relogin(jsonExtension: string): void;
82
+ /** 将本帐号的其他端踢下线
83
+ * @param clients 设备标识
84
+ * @return bool 检查参数如果不符合要求则返回失败, 接口调用成功后的结果通过注册RegKickOtherClientCb回调得到
85
+ */
86
+ kickOtherClient(clients: Array<string>): void;
87
+ /** (全局回调)设置多端推送
88
+ * @param switch_on 开关
89
+ * @param cb 回调函数
90
+ * @param jsonExtension json扩展参数(备用,目前不需要)
91
+ * @return void
92
+ * @note
93
+ * <pre>
94
+ * 200:成功
95
+ * </pre>
96
+ */
97
+ setMultiportPushConfigAsync(switch_on: boolean, cb: MultiportPushConfigCallback, jsonExtension: string): void;
98
+ /** 获得多端推送设置
99
+ * @param cb 回调函数
100
+ * @param jsonExtension json扩展参数(备用,目前不需要)
101
+ * @return void
102
+ */
103
+ getMultiportPushConfigAsync(cb: MultiportPushConfigCallback, jsonExtension: string): void;
104
+ /** 获取SDK版本号
105
+ * @return string 版本号
106
+ */
107
+ getSDKVersion(): string;
108
+ /** 获取当前服务器时间
109
+ * @param cb 操作结果的回调函数
110
+ * @param calc_local 是否在本地计算,false:直接到服务端查询 ,true:根据上次查询到的服务端时间与本地系统启动时间来计算,不会到服务端查询
111
+ * @return void
112
+ * @note
113
+ * <pre>
114
+ * 由于网络上/下行的原因,返回的时间会存在一定误差,
115
+ * 当 calc_local == false 时,如果跟上次调用该方法的时间间隔小于1000ms,SDK会采用 calc_local == true
116
+ * 时的方案以减少服务端的压力,并会在回调中指明返回的时间是由本地计算的。 如果返回 code != 200,同样会返回一个本地计算结果
117
+ * </pre>
118
+ */
119
+ getServerCurrentTime(cb: GetCurrentServerTimeCallback, calcLocal: boolean): void;
120
+ /** 获取当前登录的用户账号(accid)
121
+ * @return string 当前登录的用户账号(accid)
122
+ * @note 没有登录时将返回空字符串 */
123
+ getCurrentUserAccount(): string;
124
+ }
@@ -0,0 +1,13 @@
1
+ /// <reference types="node" />
2
+ import ev from 'events';
3
+ import { NIMDataSyncAPI } from '../def/data_sync_def';
4
+ export declare interface NIMDataSync {
5
+ on(event: 'complete', listener: () => void): this;
6
+ once(event: 'complete', listener: () => void): this;
7
+ }
8
+ export declare class NIMDataSync extends ev.EventEmitter {
9
+ dataSync: NIMDataSyncAPI;
10
+ constructor();
11
+ /** 注册全局回调 */
12
+ initEventHandlers(): void;
13
+ }
@@ -0,0 +1,82 @@
1
+ /// <reference types="node" />
2
+ import ev from 'events';
3
+ import { DeleteFriendOption, FriendProfile, NIMFriendAPI, FriendOptCallback, GetFriendProfileCallback, GetFriendsListCallback, NIMVerifyType } from '../def/friend_def';
4
+ export declare interface NIMFriend {
5
+ on(event: 'change', listener: () => void): this;
6
+ once(event: 'change', listener: () => void): this;
7
+ }
8
+ export declare class NIMFriend extends ev.EventEmitter {
9
+ friend: NIMFriendAPI;
10
+ constructor();
11
+ /** 注册全局回调 */
12
+ initEventHandlers(): void;
13
+ /** 添加、验证好友
14
+ * @param accid 对方帐号
15
+ * @param verify_type 好友验证类型
16
+ * @param msg 接口扩展字段
17
+ * @param cb 好友请求回调函数
18
+ * @param jsonExtension json扩展参数(备用,目前不需要)
19
+ * @return bool 检查参数如果不符合要求则返回失败
20
+ * @note
21
+ * <pre>
22
+ * 200:成功
23
+ * 404:用户不存在
24
+ * 500:未知错误
25
+ * </pre>
26
+ */
27
+ request(accid: string, verify_type: NIMVerifyType, msg: string, cb: FriendOptCallback, jsonExtension: string): boolean;
28
+ /** 删除好友
29
+ * @param accid 对方帐号
30
+ * @param option 删除好友选项,目前仅有是否删除备注信息选项
31
+ * @param cb 删除好友回调函数
32
+ * @return bool 检查参数如果不符合要求则返回失败
33
+ * @note
34
+ * <pre>
35
+ * 200:成功
36
+ * 404:用户不存在
37
+ * 500:未知错误
38
+ * </pre>
39
+ */
40
+ delete(accid: string, option: DeleteFriendOption, cb: FriendOptCallback): boolean;
41
+ /** 更新好友资料
42
+ * @param profile 好友资料
43
+ * @param cb 更新好友资料回调函数
44
+ * @param jsonExtension json扩展参数(备用,目前不需要)
45
+ * @return bool 检查参数如果不符合要求则返回失败
46
+ * @note
47
+ * <pre>
48
+ * 200:成功
49
+ * 404:用户不存在
50
+ * 500:未知错误
51
+ * </pre>
52
+ */
53
+ update(profile: FriendProfile, cb: FriendOptCallback, jsonExtension: string): boolean;
54
+ /** 增量获取好友列表
55
+ * @param cb 获取好友列表回调函数
56
+ * @param jsonExtension json扩展参数(备用,目前不需要)
57
+ * @return void 无返回值
58
+ * @note
59
+ * <pre>
60
+ * 200:成功
61
+ * </pre>
62
+ */
63
+ getList(cb: GetFriendsListCallback, jsonExtension: string): void;
64
+ /** 获取好友信息
65
+ * @param accid 对方帐号
66
+ * @param cb 获取好友信息回调函数
67
+ * @param jsonExtension json扩展参数(备用,目前不需要)
68
+ * @return void 无返回值
69
+ */
70
+ getFriendProfile(accid: string, cb: GetFriendProfileCallback, jsonExtension: string): void;
71
+ /** 增量获取好友列表
72
+ * @param keyword 要查询的关键字
73
+ * @param cb 获取好友列表回调函数
74
+ * @param jsonExtension json扩展参数(备用,目前不需要)
75
+ * @return bool 返回 true 表示发送查询请求成功,返回 false 表示关键字为空
76
+ * @note
77
+ * <pre>
78
+ * 200:成功
79
+ * </pre>
80
+ */
81
+ queryFriendListByKeyword(keyword: string, cb: GetFriendsListCallback, jsonExtension: string): boolean;
82
+ }
@@ -0,0 +1,69 @@
1
+ /// <reference types="node" />
2
+ import ev from 'events';
3
+ import { DeleteCachedFileCallback, DetectProxyCallback, ExceptionCallback, GetCachedFileInfoCallback, NIMCachedFileType, NIMGlobalAPI, NIMProxyType, SDKFeedbackCallback, UploadSDKLogCallback } from '../def/global_def';
4
+ export declare interface NIMGlobal {
5
+ on(event: 'dbError', listener: () => void): this;
6
+ once(event: 'dbError', listener: () => void): this;
7
+ }
8
+ export declare class NIMGlobal extends ev.EventEmitter {
9
+ global: NIMGlobalAPI;
10
+ constructor();
11
+ /** 注册全局回调 */
12
+ initEventHandlers(): void;
13
+ /** 注册输出系统环境异常的回调
14
+ * @param jsonExtension json扩展参数(备用,目前不需要)
15
+ * @param cb
16
+ * @return void 无返回值
17
+ */
18
+ setExceptionReportCallback(jsonExtension: string, cb: ExceptionCallback): void;
19
+ /** 设置SDK统一的网络代理。不需要代理时,type设置为kNIMProxyNone,其余参数都传空字符串(端口设为0)。有些代理不需要用户名和密码,相应参数也传空字符串。
20
+ * @param type 代理类型,见NIMProxyType定义
21
+ * @param host 代理地址
22
+ * @param port 代理端口
23
+ * @param user 代理用户名
24
+ * @param password 代理密码
25
+ * @return void 无返回值
26
+ */
27
+ setProxy(type: NIMProxyType, host: string, port: number, user: string, password: string): void;
28
+ /** 测试代理
29
+ * @param type 代理类型,见NIMProxyType定义
30
+ * @param host 代理地址
31
+ * @param port 代理端口
32
+ * @param user 代理用户名
33
+ * @param password 代理密码
34
+ * @param cb 回调函数
35
+ * @return void 无返回值
36
+ */
37
+ detectProxy(type: NIMProxyType, host: string, port: number, user: string, password: string, cb: DetectProxyCallback): void;
38
+ /** 获取sdk缓存文件信息
39
+ * @param loginId 查询的账号ID
40
+ * @param fileType 文件类型,常量定义见NIMCachedFileType
41
+ * @param endTimestamp 查询时间截止点(查询全部填0)
42
+ * @param jsonExtension json扩展参数(备用,目前不需要)
43
+ * @param cb
44
+ * @return void 无返回值
45
+ */
46
+ getSDKCachedFileInfoAsync(loginId: string, fileType: NIMCachedFileType, endTimestamp: number, jsonExtension: string, cb: GetCachedFileInfoCallback): void;
47
+ /** 删除sdk缓存文件
48
+ * @param loginId 查询的账号ID
49
+ * @param fileType 文件类型,常量定义见NIMCachedFileType
50
+ * @param endTimestamp 删除时间截止点(查询全部填0)
51
+ * @param jsonExtension json扩展参数(备用,目前不需要)
52
+ * @param cb
53
+ * @return void 无返回值
54
+ */
55
+ deleteSDKCachedFileAsync(loginId: string, fileType: NIMCachedFileType, endTimestamp: number, jsonExtension: string, cb: DeleteCachedFileCallback): void;
56
+ /** SDK 反馈
57
+ * @param url 开发者需将所需要反馈的文件(dump,应用日志等)上传至nos。
58
+ * @param jsonExtension json扩展参数(备用,目前不需要)
59
+ * @param cb
60
+ * @return void 无返回值
61
+ */
62
+ sdkFeedbackAsync(url: string, jsonExtension: string, cb: SDKFeedbackCallback): void;
63
+ /** 上传SDK日志到服务器
64
+ * @param feedbackStr 反馈信息
65
+ * @param cb 操作结果的回调函数
66
+ * @return void
67
+ */
68
+ uploadSDKLog(feedbackStr: string, cb: UploadSDKLogCallback): void;
69
+ }