hunter-open-sdk 2.0.0-beta.18 → 2.0.0-beta.19
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/lib/abilities/activate/index.js +12 -18
- package/lib/abilities/activate/worker.js +6 -17
- package/lib/abilities/erase/index.js +12 -18
- package/lib/abilities/erase/worker.js +6 -17
- package/lib/{registerEvent → abilities/eventManager}/index.js +28 -26
- package/lib/{getAndroidSn → abilities/getAndroidSn}/index.js +10 -9
- package/lib/abilities/getGeneralReport/index.js +11 -17
- package/lib/abilities/getGeneralReport/worker.js +19 -32
- package/lib/abilities/getSaaSReport/index.js +11 -17
- package/lib/abilities/getSaaSReport/worker.js +6 -11
- package/lib/abilities/installApp/index.js +48 -0
- package/lib/abilities/installApp/worker.js +19 -0
- package/lib/abilities/reboot/index.js +12 -18
- package/lib/abilities/reboot/worker.js +6 -17
- package/lib/abilities/shutdown/index.js +12 -18
- package/lib/abilities/shutdown/worker.js +6 -17
- package/lib/abilities/skip/index.js +12 -18
- package/lib/abilities/skip/worker.js +6 -17
- package/lib/index.js +9 -7
- package/lib/resources/dll/{libinspectionkit_x64_0.3.2.dll → libinspectionkit_x64_0.4.0.dll} +0 -0
- package/lib/resources/mac/{libinspectionkit_amd64_0.3.2.dylib → libinspectionkit_amd64_0.4.0.dylib} +0 -0
- package/lib/resources/mac/{libinspectionkit_arm64_0.3.2.dylib → libinspectionkit_arm64_0.4.0.dylib} +0 -0
- package/lib/resources/version.online +1 -1
- package/lib/utils/utils.ability.js +9 -0
- package/lib/utils/utils.common.js +13 -1
- package/lib/utils/utils.global.js +36 -258
- package/package.json +1 -1
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.reboot = reboot;
|
|
7
7
|
var _webWorker = _interopRequireDefault(require("web-worker"));
|
|
8
8
|
var _url = _interopRequireDefault(require("url"));
|
|
9
|
-
var _utils = require("../../utils/utils.
|
|
9
|
+
var _utils = require("../../utils/utils.common");
|
|
10
|
+
var _utils2 = require("../../utils/utils.path");
|
|
11
|
+
var _utils3 = require("../../utils/utils.ability");
|
|
10
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
13
|
class Reboot {
|
|
12
14
|
constructor() {
|
|
@@ -15,33 +17,24 @@ class Reboot {
|
|
|
15
17
|
}
|
|
16
18
|
worker = null;
|
|
17
19
|
callback = null;
|
|
18
|
-
exec(
|
|
19
|
-
this.callback = callback;
|
|
20
|
+
exec(payload, callback) {
|
|
21
|
+
this.callback = typeof callback === 'function' ? callback : _utils3.defaultCallback;
|
|
20
22
|
this.worker && this.worker.postMessage({
|
|
21
|
-
|
|
22
|
-
params
|
|
23
|
+
payload
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
initWorkerListener() {
|
|
26
27
|
this.worker && this.worker.addEventListener('message', event => {
|
|
27
28
|
const {
|
|
28
|
-
|
|
29
|
-
data
|
|
29
|
+
payload
|
|
30
30
|
} = event.data;
|
|
31
|
-
|
|
32
|
-
case 'rebootSuccess':
|
|
33
|
-
this.callback(data);
|
|
34
|
-
break;
|
|
35
|
-
case 'rebootFail':
|
|
36
|
-
this.callback(data);
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
31
|
+
this.callback(payload);
|
|
39
32
|
this.callback = null;
|
|
40
33
|
});
|
|
41
34
|
}
|
|
42
35
|
initWorker() {
|
|
43
36
|
if (!this.worker) {
|
|
44
|
-
const workerPath = new _url.default.URL('file://' + (0,
|
|
37
|
+
const workerPath = new _url.default.URL('file://' + (0, _utils2.getCurrentEnvPath)(__dirname, './worker.js'));
|
|
45
38
|
this.worker = new _webWorker.default(workerPath, {
|
|
46
39
|
type: "module"
|
|
47
40
|
});
|
|
@@ -49,6 +42,7 @@ class Reboot {
|
|
|
49
42
|
}
|
|
50
43
|
}
|
|
51
44
|
const entity = new Reboot();
|
|
52
|
-
function reboot(
|
|
53
|
-
|
|
45
|
+
function reboot(params, callback) {
|
|
46
|
+
const payload = (0, _utils.parsePayload)(params);
|
|
47
|
+
entity.exec(payload, callback);
|
|
54
48
|
}
|
|
@@ -3,28 +3,17 @@
|
|
|
3
3
|
const {
|
|
4
4
|
initWorkerNodePath
|
|
5
5
|
} = require("../../utils/utils.worker");
|
|
6
|
+
|
|
7
|
+
// 先注册NodePath后才能正常使用node包,请勿挪动位置
|
|
6
8
|
initWorkerNodePath();
|
|
7
9
|
const {
|
|
8
|
-
|
|
10
|
+
abilityCallKit
|
|
9
11
|
} = require("../../utils/utils.global");
|
|
10
12
|
function onMainMessage(event) {
|
|
11
13
|
const {
|
|
12
|
-
|
|
13
|
-
params
|
|
14
|
+
payload
|
|
14
15
|
} = event.data;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
if (!params) {
|
|
19
|
-
return {
|
|
20
|
-
code: -1,
|
|
21
|
-
message: '【reboot】方法缺少必要参数'
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
const res = rebootCallKit(params);
|
|
25
|
-
postMessage(res);
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
16
|
+
const res = abilityCallKit('reboot', payload);
|
|
17
|
+
postMessage(res);
|
|
29
18
|
}
|
|
30
19
|
addEventListener('message', onMainMessage);
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.shutdown = shutdown;
|
|
7
7
|
var _webWorker = _interopRequireDefault(require("web-worker"));
|
|
8
8
|
var _url = _interopRequireDefault(require("url"));
|
|
9
|
-
var _utils = require("../../utils/utils.
|
|
9
|
+
var _utils = require("../../utils/utils.common");
|
|
10
|
+
var _utils2 = require("../../utils/utils.path");
|
|
11
|
+
var _utils3 = require("../../utils/utils.ability");
|
|
10
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
13
|
class Shutdown {
|
|
12
14
|
constructor() {
|
|
@@ -15,33 +17,24 @@ class Shutdown {
|
|
|
15
17
|
}
|
|
16
18
|
worker = null;
|
|
17
19
|
callback = null;
|
|
18
|
-
exec(
|
|
19
|
-
this.callback = callback;
|
|
20
|
+
exec(payload, callback) {
|
|
21
|
+
this.callback = typeof callback === 'function' ? callback : _utils3.defaultCallback;
|
|
20
22
|
this.worker && this.worker.postMessage({
|
|
21
|
-
|
|
22
|
-
params
|
|
23
|
+
payload
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
initWorkerListener() {
|
|
26
27
|
this.worker && this.worker.addEventListener('message', event => {
|
|
27
28
|
const {
|
|
28
|
-
|
|
29
|
-
data
|
|
29
|
+
payload
|
|
30
30
|
} = event.data;
|
|
31
|
-
|
|
32
|
-
case 'shutdownSuccess':
|
|
33
|
-
this.callback(data);
|
|
34
|
-
break;
|
|
35
|
-
case 'shutdownFail':
|
|
36
|
-
this.callback(data);
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
31
|
+
this.callback(payload);
|
|
39
32
|
this.callback = null;
|
|
40
33
|
});
|
|
41
34
|
}
|
|
42
35
|
initWorker() {
|
|
43
36
|
if (!this.worker) {
|
|
44
|
-
const workerPath = new _url.default.URL('file://' + (0,
|
|
37
|
+
const workerPath = new _url.default.URL('file://' + (0, _utils2.getCurrentEnvPath)(__dirname, './worker.js'));
|
|
45
38
|
this.worker = new _webWorker.default(workerPath, {
|
|
46
39
|
type: "module"
|
|
47
40
|
});
|
|
@@ -49,6 +42,7 @@ class Shutdown {
|
|
|
49
42
|
}
|
|
50
43
|
}
|
|
51
44
|
const entity = new Shutdown();
|
|
52
|
-
function shutdown(
|
|
53
|
-
|
|
45
|
+
function shutdown(params, callback) {
|
|
46
|
+
const payload = (0, _utils.parsePayload)(params);
|
|
47
|
+
entity.exec(payload, callback);
|
|
54
48
|
}
|
|
@@ -3,28 +3,17 @@
|
|
|
3
3
|
const {
|
|
4
4
|
initWorkerNodePath
|
|
5
5
|
} = require("../../utils/utils.worker");
|
|
6
|
+
|
|
7
|
+
// 先注册NodePath后才能正常使用node包,请勿挪动位置
|
|
6
8
|
initWorkerNodePath();
|
|
7
9
|
const {
|
|
8
|
-
|
|
10
|
+
abilityCallKit
|
|
9
11
|
} = require("../../utils/utils.global");
|
|
10
12
|
function onMainMessage(event) {
|
|
11
13
|
const {
|
|
12
|
-
|
|
13
|
-
params
|
|
14
|
+
payload
|
|
14
15
|
} = event.data;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
if (!params) {
|
|
19
|
-
return {
|
|
20
|
-
code: -1,
|
|
21
|
-
message: '【shutdown】方法缺少必要参数'
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
const res = shutdownCallKit(params);
|
|
25
|
-
postMessage(res);
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
16
|
+
const res = abilityCallKit('shutdown', payload);
|
|
17
|
+
postMessage(res);
|
|
29
18
|
}
|
|
30
19
|
addEventListener('message', onMainMessage);
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.skip = skip;
|
|
7
7
|
var _webWorker = _interopRequireDefault(require("web-worker"));
|
|
8
8
|
var _url = _interopRequireDefault(require("url"));
|
|
9
|
-
var _utils = require("../../utils/utils.
|
|
9
|
+
var _utils = require("../../utils/utils.common");
|
|
10
|
+
var _utils2 = require("../../utils/utils.path");
|
|
11
|
+
var _utils3 = require("../../utils/utils.ability");
|
|
10
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
13
|
class Skip {
|
|
12
14
|
constructor() {
|
|
@@ -15,33 +17,24 @@ class Skip {
|
|
|
15
17
|
}
|
|
16
18
|
worker = null;
|
|
17
19
|
callback = null;
|
|
18
|
-
exec(
|
|
19
|
-
this.callback = callback;
|
|
20
|
+
exec(payload, callback) {
|
|
21
|
+
this.callback = typeof callback === 'function' ? callback : _utils3.defaultCallback;
|
|
20
22
|
this.worker && this.worker.postMessage({
|
|
21
|
-
|
|
22
|
-
params
|
|
23
|
+
payload
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
initWorkerListener() {
|
|
26
27
|
this.worker && this.worker.addEventListener('message', event => {
|
|
27
28
|
const {
|
|
28
|
-
|
|
29
|
-
data
|
|
29
|
+
payload
|
|
30
30
|
} = event.data;
|
|
31
|
-
|
|
32
|
-
case 'skipSuccess':
|
|
33
|
-
this.callback(data);
|
|
34
|
-
break;
|
|
35
|
-
case 'skipFail':
|
|
36
|
-
this.callback(data);
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
31
|
+
this.callback(payload);
|
|
39
32
|
this.callback = null;
|
|
40
33
|
});
|
|
41
34
|
}
|
|
42
35
|
initWorker() {
|
|
43
36
|
if (!this.worker) {
|
|
44
|
-
const workerPath = new _url.default.URL('file://' + (0,
|
|
37
|
+
const workerPath = new _url.default.URL('file://' + (0, _utils2.getCurrentEnvPath)(__dirname, './worker.js'));
|
|
45
38
|
this.worker = new _webWorker.default(workerPath, {
|
|
46
39
|
type: 'module'
|
|
47
40
|
});
|
|
@@ -49,6 +42,7 @@ class Skip {
|
|
|
49
42
|
}
|
|
50
43
|
}
|
|
51
44
|
const entity = new Skip();
|
|
52
|
-
function skip(
|
|
53
|
-
|
|
45
|
+
function skip(params, callback) {
|
|
46
|
+
const payload = (0, _utils.parsePayload)(params);
|
|
47
|
+
entity.exec(payload, callback);
|
|
54
48
|
}
|
|
@@ -3,28 +3,17 @@
|
|
|
3
3
|
const {
|
|
4
4
|
initWorkerNodePath
|
|
5
5
|
} = require("../../utils/utils.worker");
|
|
6
|
+
|
|
7
|
+
// 先注册NodePath后才能正常使用node包,请勿挪动位置
|
|
6
8
|
initWorkerNodePath();
|
|
7
9
|
const {
|
|
8
|
-
|
|
10
|
+
abilityCallKit
|
|
9
11
|
} = require("../../utils/utils.global");
|
|
10
12
|
function onMainMessage(event) {
|
|
11
13
|
const {
|
|
12
|
-
|
|
13
|
-
params
|
|
14
|
+
payload
|
|
14
15
|
} = event.data;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
if (!params) {
|
|
19
|
-
return {
|
|
20
|
-
code: -1,
|
|
21
|
-
message: '【skip】方法缺少必要参数'
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
const res = skipCallKit(params);
|
|
25
|
-
postMessage(res);
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
16
|
+
const res = abilityCallKit('skip', payload);
|
|
17
|
+
postMessage(res);
|
|
29
18
|
}
|
|
30
19
|
addEventListener('message', onMainMessage);
|
package/lib/index.js
CHANGED
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var _getAndroidSn = require("./abilities/getAndroidSn");
|
|
8
|
+
var _eventManager = require("./abilities/eventManager");
|
|
9
9
|
var _getSaaSReport = require("./abilities/getSaaSReport");
|
|
10
10
|
var _getGeneralReport = require("./abilities/getGeneralReport");
|
|
11
11
|
var _erase = require("./abilities/erase");
|
|
@@ -13,6 +13,7 @@ var _activate = require("./abilities/activate");
|
|
|
13
13
|
var _skip = require("./abilities/skip");
|
|
14
14
|
var _reboot = require("./abilities/reboot");
|
|
15
15
|
var _shutdown = require("./abilities/shutdown");
|
|
16
|
+
var _installApp = require("./abilities/installApp");
|
|
16
17
|
const Sentry = require('@sentry/browser');
|
|
17
18
|
Sentry.init({
|
|
18
19
|
dsn: 'https://8a5296c59083430fbac0756f56ddbf5d@sentry.zhuanzhuan.com/2300',
|
|
@@ -21,15 +22,16 @@ Sentry.init({
|
|
|
21
22
|
console.log('Sentry initialized');
|
|
22
23
|
// 初始化
|
|
23
24
|
var _default = exports.default = {
|
|
24
|
-
registerEvent:
|
|
25
|
-
unregisterEvent:
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
registerEvent: _eventManager.registerEvent,
|
|
26
|
+
unregisterEvent: _eventManager.unregisterEvent,
|
|
27
|
+
registerGetAndroidSn: _getAndroidSn.registerGetAndroidSn,
|
|
28
|
+
unregisterGetAndroidSn: _getAndroidSn.unregisterGetAndroidSn,
|
|
28
29
|
getSaaSReport: _getSaaSReport.getSaaSReport,
|
|
29
30
|
getGeneralReport: _getGeneralReport.getGeneralReport,
|
|
30
31
|
erase: _erase.erase,
|
|
31
32
|
activate: _activate.activate,
|
|
32
33
|
skip: _skip.skip,
|
|
33
34
|
reboot: _reboot.reboot,
|
|
34
|
-
shutdown: _shutdown.shutdown
|
|
35
|
+
shutdown: _shutdown.shutdown,
|
|
36
|
+
installApp: _installApp.installApp
|
|
35
37
|
};
|
|
Binary file
|
package/lib/resources/mac/{libinspectionkit_amd64_0.3.2.dylib → libinspectionkit_amd64_0.4.0.dylib}
RENAMED
|
Binary file
|
package/lib/resources/mac/{libinspectionkit_arm64_0.3.2.dylib → libinspectionkit_arm64_0.4.0.dylib}
RENAMED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.4.0
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.parsePayload = parsePayload;
|
|
6
7
|
exports.sleep = void 0;
|
|
7
8
|
const sleep = () => {
|
|
8
9
|
return new Promise(resolve => {
|
|
@@ -11,4 +12,15 @@ const sleep = () => {
|
|
|
11
12
|
}, 1000);
|
|
12
13
|
});
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
// 解析参数
|
|
17
|
+
exports.sleep = sleep;
|
|
18
|
+
function parsePayload(params) {
|
|
19
|
+
let oParams = typeof params === 'string' ? JSON.parse(params) : params;
|
|
20
|
+
const payloadParams = oParams.params ?? oParams;
|
|
21
|
+
const payloadBiz = oParams.biz ?? oParams;
|
|
22
|
+
return {
|
|
23
|
+
params: typeof payloadParams === 'object' ? JSON.stringify(payloadParams) : payloadParams,
|
|
24
|
+
biz: typeof payloadBiz === 'object' ? JSON.stringify(payloadBiz) : payloadBiz
|
|
25
|
+
};
|
|
26
|
+
}
|