@tencentcloud/trtc-cloud-wx 1.0.8 → 1.0.9-beta.0

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 (56) hide show
  1. package/.babelrc +6 -0
  2. package/.eslintrc.json +129 -0
  3. package/build/chokidar.js +19 -0
  4. package/build/clear.js +24 -0
  5. package/build/copy.js +24 -0
  6. package/build/copy_to_roomkit.js +19 -0
  7. package/dist/package.json +14 -0
  8. package/{trtc-cloud-wx.js → dist/trtc-cloud-wx.js} +15 -5
  9. package/docs/API/TRTCCloud.html +4353 -0
  10. package/docs/API/index.html +98 -0
  11. package/docs/API/scripts/add-toc.js +57 -0
  12. package/docs/API/scripts/collapse.js +20 -0
  13. package/docs/API/scripts/highlight/highlight.min.js +1282 -0
  14. package/docs/API/scripts/highlight/highlightjs-line-numbers.min.js +1 -0
  15. package/docs/API/scripts/linenumber.js +25 -0
  16. package/docs/API/scripts/nav.js +12 -0
  17. package/docs/API/scripts/polyfill.js +4 -0
  18. package/docs/API/scripts/prettify/Apache-License-2.0.txt +202 -0
  19. package/docs/API/scripts/prettify/lang-css.js +2 -0
  20. package/docs/API/scripts/prettify/prettify.js +28 -0
  21. package/docs/API/scripts/search.js +83 -0
  22. package/docs/API/styles/font.css +81 -0
  23. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3g3D_vx3rCubqg.woff2 +0 -0
  24. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gTD_vx3rCubqg.woff2 +0 -0
  25. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gbD_vx3rCubqg.woff2 +0 -0
  26. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gfD_vx3rCubqg.woff2 +0 -0
  27. package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gnD_vx3rCs.woff2 +0 -0
  28. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459W1hyyTh89ZNpQ.woff2 +0 -0
  29. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WRhyyTh89ZNpQ.woff2 +0 -0
  30. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WZhyyTh89ZNpQ.woff2 +0 -0
  31. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WdhyyTh89ZNpQ.woff2 +0 -0
  32. package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WlhyyTh89Y.woff2 +0 -0
  33. package/docs/API/styles/highlight/highlight.min.css +26 -0
  34. package/docs/API/styles/highlight/rainbow.min.css +1 -0
  35. package/docs/API/styles/jsdoc.css +684 -0
  36. package/docs/API/styles/prettify.css +79 -0
  37. package/docs/API/styles/toc.css +44 -0
  38. package/docs/API/tutorial-00-guideline.html +81 -0
  39. package/docs/doc-src/home.md +7 -0
  40. package/docs/doc-src/tutorials/00-guideline.md +1 -0
  41. package/docs/doc-src/tutorials/tutorials.json +5 -0
  42. package/jsdoc.json +43 -0
  43. package/package.json +40 -2
  44. package/rollup.config.js +19 -0
  45. package/sdk_publish.bash +5 -0
  46. package/src/TaskMachine.ts +371 -0
  47. package/src/index.ts +1184 -0
  48. package/src/interface/index.ts +45 -0
  49. package/src/interface/types.ts +95 -0
  50. package/src/log/logger.ts +80 -0
  51. package/src/types.d.ts +1 -0
  52. package/src/utils/common.ts +50 -0
  53. package/src/utils/index.ts +2 -0
  54. package/src/utils/translate.ts +139 -0
  55. package/tsconfig.json +15 -0
  56. package/typedoc.json +21 -0
package/.babelrc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "presets": [
3
+ "@babel/preset-env",
4
+ "@babel/preset-typescript"
5
+ ]
6
+ }
package/.eslintrc.json ADDED
@@ -0,0 +1,129 @@
1
+ {
2
+ "extends": [
3
+ "airbnb-base",
4
+ "plugin:promise/recommended",
5
+ "plugin:import/typescript",
6
+ "plugin:@typescript-eslint/recommended"
7
+ ],
8
+ "parser": "@typescript-eslint/parser",
9
+ "plugins": [
10
+ "@typescript-eslint",
11
+ "import",
12
+ "node",
13
+ "promise"
14
+ ],
15
+ "parserOptions": {
16
+ "ecmaVersion": 9,
17
+ "ecmaFeatures": {
18
+ "jsx": false
19
+ },
20
+ "sourceType": "module"
21
+ },
22
+ "env": {
23
+ "es6": true,
24
+ "node": true,
25
+ "jest": true
26
+ },
27
+ "settings": {
28
+ "import/resolver": {
29
+ "node": {
30
+ "extensions": [
31
+ ".js",
32
+ ".jsx",
33
+ ".ts",
34
+ ".tsx"
35
+ ]
36
+ }
37
+ }
38
+ },
39
+ "rules": {
40
+ // "@typescript-eslint/explicit-function-return-type": "off",
41
+ "explicit-module-boundary-types": "off",
42
+ "max-len": ["error", {"code": 120}],
43
+ "import/extensions": 0,
44
+ "no-unused-expressions": [
45
+ "error",
46
+ {
47
+ "allowTernary": true
48
+ }
49
+ ],
50
+ "no-empty-function": "off",
51
+ "@typescript-eslint/no-empty-function": "off",
52
+ "class-methods-use-this": "off",
53
+ "arrow-parens": "off",
54
+ "comma-dangle": [
55
+ "error",
56
+ "only-multiline"
57
+ ],
58
+ "complexity": [
59
+ "error",
60
+ 20
61
+ ],
62
+ "func-names": "off",
63
+ "global-require": "off",
64
+ "handle-callback-err": [
65
+ "error",
66
+ "^(err|error)$"
67
+ ],
68
+ "import/no-unresolved": [
69
+ "error",
70
+ {
71
+ "caseSensitive": true,
72
+ "commonjs": true,
73
+ "ignore": [
74
+ "^[^.]"
75
+ ]
76
+ }
77
+ ],
78
+ "import/prefer-default-export": "off",
79
+ "linebreak-style": "off",
80
+ "no-catch-shadow": "error",
81
+ "no-continue": "off",
82
+ "no-div-regex": "warn",
83
+ "no-else-return": "off",
84
+ "no-param-reassign": "off",
85
+ "no-plusplus": "off",
86
+ "no-shadow": "off",
87
+ "no-multi-assign": "off",
88
+ "no-underscore-dangle": "off",
89
+ "node/no-deprecated-api": "error",
90
+ "node/process-exit-as-throw": "error",
91
+ "object-curly-spacing": [
92
+ "error",
93
+ "never"
94
+ ],
95
+ "operator-linebreak": [
96
+ "error",
97
+ "after",
98
+ {
99
+ "overrides": {
100
+ ":": "before",
101
+ "?": "before"
102
+ }
103
+ }
104
+ ],
105
+ "prefer-arrow-callback": "off",
106
+ "prefer-destructuring": "off",
107
+ "prefer-template": "off",
108
+ "quote-props": [
109
+ 1,
110
+ "as-needed",
111
+ {
112
+ "unnecessary": true
113
+ }
114
+ ],
115
+ "semi": [
116
+ "error",
117
+ "never"
118
+ ],
119
+ "no-await-in-loop": "off",
120
+ "no-restricted-syntax": "off",
121
+ "promise/always-return": "off"
122
+ },
123
+ "globals": {
124
+ "window": true,
125
+ "document": true,
126
+ "App": true,
127
+ "wx": true
128
+ }
129
+ }
@@ -0,0 +1,19 @@
1
+ import path from 'path'
2
+ import chokidar from 'chokidar'
3
+ import {exec} from 'child_process'
4
+
5
+ const __dirname = new URL('.', import.meta.url).pathname
6
+
7
+
8
+ const srcDir = path.resolve(__dirname, '../src')
9
+
10
+ chokidar.watch(srcDir).on('all', async (event, filePath) => {
11
+ console.log(`${event}: ${filePath}`)
12
+ if (event === 'change' || event === 'add') {
13
+ exec('npm run build', (err, stdout, stderr) => {
14
+ if (err) console.error(err)
15
+ console.log(stdout)
16
+ console.error(stderr)
17
+ })
18
+ }
19
+ })
package/build/clear.js ADDED
@@ -0,0 +1,24 @@
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+
4
+ // 获取 dist 目录的绝对路径
5
+ const distPath = path.resolve(new URL('.', import.meta.url).pathname, '../dist')
6
+ // 定义一个函数,用于删除指定目录下的所有文件和文件夹
7
+ function deleteFolderRecursive(folderPath) {
8
+ if (fs.existsSync(folderPath)) {
9
+ fs.readdirSync(folderPath).forEach(file => {
10
+ const curPath = path.join(folderPath, file)
11
+ if (fs.lstatSync(curPath).isDirectory()) {
12
+ deleteFolderRecursive(curPath)
13
+ } else if (!curPath.includes('package.json')) {
14
+ fs.unlinkSync(curPath)
15
+ }
16
+ })
17
+ // fs.rmdirSync(folderPath);
18
+ }
19
+ }
20
+
21
+ // 调用函数,删除 dist 目录下的所有文件和文件夹
22
+ deleteFolderRecursive(distPath)
23
+
24
+ console.log('清理完成!')
package/build/copy.js ADDED
@@ -0,0 +1,24 @@
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+
4
+ const __dirname = new URL('.', import.meta.url).pathname
5
+
6
+ const distPath = path.resolve(__dirname, '../dist')
7
+ const targetPathList = [
8
+ // path.resolve(__dirname, "../trtc-custom-component/src"),
9
+ path.resolve(__dirname, '../../trtc-component-wx/miniprogram_dev/node_modules/@tencentcloud/trtc-cloud-wx'),
10
+ ]
11
+
12
+ fs.readdir(distPath, (err, files) => {
13
+ if (err) throw err
14
+ files.forEach((file) => {
15
+ targetPathList.forEach((targetPath) => {
16
+ const srcPath = path.join(distPath, file)
17
+ const destPath = path.join(targetPath, file)
18
+ fs.copyFile(srcPath, destPath, (err) => {
19
+ if (err) throw err
20
+ console.log(`${file} has been copied to ${targetPath}`)
21
+ })
22
+ })
23
+ })
24
+ })
@@ -0,0 +1,19 @@
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+
4
+ const sourceDir = '/Users/connor/Desktop/work/TRTCCloud-wx/trtc-cloud-wx/dist'
5
+ const targetDir = '/Users/connor/Desktop/TUIRoomEngine/samples/tui-room-uniapp/dist/dev/mp-weixin/node_modules/@tencentcloud/trtc-cloud-wx'
6
+
7
+ fs.readdir(sourceDir, (err, files) => {
8
+ if (err) throw err
9
+
10
+ files.forEach((file) => {
11
+ const sourceFile = path.join(sourceDir, file)
12
+ const targetFile = path.join(targetDir, file)
13
+
14
+ fs.copyFile(sourceFile, targetFile, (err) => {
15
+ if (err) throw err
16
+ console.log(`${sourceFile} was copied to ${targetFile}`)
17
+ })
18
+ })
19
+ })
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@tencentcloud/trtc-cloud-wx",
3
+ "version": "1.0.9",
4
+ "description": "",
5
+ "main": "./trtc-cloud-wx.js",
6
+ "type": "module",
7
+ "keywords": [],
8
+ "author": "",
9
+ "license": "ISC",
10
+ "dependencies": {
11
+ "eventemitter3": "^5.0.0",
12
+ "trtc-wx-sdk": "^1.1.14"
13
+ }
14
+ }
@@ -1388,7 +1388,7 @@ var Logger = /*#__PURE__*/function () {
1388
1388
  var logger = new Logger();
1389
1389
 
1390
1390
  var name = "@tencentcloud/trtc-cloud-wx";
1391
- var version = "1.0.8";
1391
+ var version = "1.0.9";
1392
1392
  var description = "";
1393
1393
  var main = "dist/trtc-cloud-wx.js";
1394
1394
  var module$1 = "dist/trtc-cloud-wx.js";
@@ -1794,7 +1794,8 @@ var TRTCCloud = /*#__PURE__*/function () {
1794
1794
  logger.info('enterRoom with options: ', JSON.stringify(params), scene);
1795
1795
  this.userId = userId;
1796
1796
  this.isEnterRoom = true;
1797
- _context2.next = 12;
1797
+ _context2.prev = 10;
1798
+ _context2.next = 13;
1798
1799
  return this.setAttributes({
1799
1800
  params: {
1800
1801
  sdkAppID: sdkAppId,
@@ -1813,7 +1814,16 @@ var TRTCCloud = /*#__PURE__*/function () {
1813
1814
  recvMode: this.enableinfiniteanchor ? 2 : 1 // 1 自动接收音视频 2 仅自动接收音频
1814
1815
  }
1815
1816
  }, 'enterRoom');
1816
- case 12:
1817
+ case 13:
1818
+ _context2.next = 20;
1819
+ break;
1820
+ case 15:
1821
+ _context2.prev = 15;
1822
+ _context2.t0 = _context2["catch"](10);
1823
+ this.isEnterRoom = false;
1824
+ logger.info('enterRoom fail');
1825
+ this.emit('onEnterRoom', -1);
1826
+ case 20:
1817
1827
  this.trtc.getPusherInstance().start({
1818
1828
  success: function success() {
1819
1829
  return __awaiter(_this6, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -1851,11 +1861,11 @@ var TRTCCloud = /*#__PURE__*/function () {
1851
1861
  _this6.emit('onEnterRoom', -1);
1852
1862
  }
1853
1863
  });
1854
- case 13:
1864
+ case 21:
1855
1865
  case "end":
1856
1866
  return _context2.stop();
1857
1867
  }
1858
- }, _callee2, this);
1868
+ }, _callee2, this, [[10, 15]]);
1859
1869
  }));
1860
1870
  }
1861
1871
  /**