eco-access-specifications 2.0.3 → 2.0.5
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/README.md +3 -0
- package/index.js +2 -5
- package/{Component → lib/Component}/LogComponent.js +3 -1
- package/{Utils → lib/Utils}/LogUtil.js +4 -1
- package/{base → lib/base}/CommandQueue.js +24 -10
- package/lib/index.js +5 -0
- package/lib/index.min.js +1 -0
- package/{main → lib/main}/EcoService.js +2 -0
- package/{main → lib/main}/log.js +3 -2
- package/{main → lib/main}/require.js +2 -0
- package/{page → lib/page}/LogPage.js +1 -0
- package/package.json +20 -4
- package/index.min.js +0 -1
- /package/{base → lib/base}/Utils.js +0 -0
- /package/{eco-track-report → lib/eco-track-report}/TrackUtil.js +0 -0
- /package/{eco-track-report → lib/eco-track-report}/index.js +0 -0
- /package/{global.js → lib/global.js} +0 -0
- /package/{main → lib/main}/specMethod.js +0 -0
package/README.md
ADDED
package/index.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { addLog, LogPage } from "./main/log.js";
|
|
4
|
-
import { oneTrackReport, allTrackPoints } from './eco-track-report/index.js';
|
|
5
|
-
export { LogPage, addLog, bleSpecQueue, initSpecifications, EcoService, oneTrackReport, allTrackPoints };
|
|
1
|
+
// index.js
|
|
2
|
+
module.exports = require('./lib/index');
|
|
@@ -59,7 +59,9 @@ var BaseComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
59
59
|
}
|
|
60
60
|
}, {
|
|
61
61
|
key: "addLog",
|
|
62
|
-
value: function addLog(string) {
|
|
62
|
+
value: function addLog(string) {
|
|
63
|
+
console.log("log->".concat(string));
|
|
64
|
+
}
|
|
63
65
|
}]);
|
|
64
66
|
}(React.Component);
|
|
65
67
|
export default BaseComponent;
|
|
@@ -39,7 +39,10 @@ var UnitUtil = /*#__PURE__*/function () {
|
|
|
39
39
|
}
|
|
40
40
|
}, {
|
|
41
41
|
key: "logDebug",
|
|
42
|
-
value: function logDebug() {
|
|
42
|
+
value: function logDebug() {
|
|
43
|
+
var _console;
|
|
44
|
+
(_console = console).log.apply(_console, arguments);
|
|
45
|
+
}
|
|
43
46
|
/**
|
|
44
47
|
* 时间转换
|
|
45
48
|
* @param dateTime
|
|
@@ -6,7 +6,7 @@ import { Device } from '../global.js';
|
|
|
6
6
|
import { addLog } from "../main/log.js";
|
|
7
7
|
var createCommandQueue = function createCommandQueue(specMethod) {
|
|
8
8
|
var commandArray = [];
|
|
9
|
-
var
|
|
9
|
+
var globalCallback = null; // 全局监听
|
|
10
10
|
var isProcessing = false;
|
|
11
11
|
var _checkAndExecute = /*#__PURE__*/function () {
|
|
12
12
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -28,20 +28,34 @@ var createCommandQueue = function createCommandQueue(specMethod) {
|
|
|
28
28
|
case 7:
|
|
29
29
|
result = _context.sent;
|
|
30
30
|
addLog("spec\u6307\u4EE4\u54CD\u5E94\u6210\u529F\u2705:".concat(JSON.stringify(result)));
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
if (typeof command.onResult === 'function') {
|
|
32
|
+
command.onResult({
|
|
33
|
+
type: command.specWay,
|
|
34
|
+
result: result
|
|
35
|
+
});
|
|
36
|
+
} else if (globalCallback) {
|
|
37
|
+
globalCallback({
|
|
38
|
+
type: command.specWay,
|
|
39
|
+
result: result
|
|
40
|
+
});
|
|
41
|
+
}
|
|
35
42
|
_context.next = 16;
|
|
36
43
|
break;
|
|
37
44
|
case 12:
|
|
38
45
|
_context.prev = 12;
|
|
39
46
|
_context.t0 = _context["catch"](4);
|
|
40
47
|
addLog("spec\u274C\u5931\u8D25:".concat(JSON.stringify(_context.t0)));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
if (typeof command.onResult === 'function') {
|
|
49
|
+
command.onResult({
|
|
50
|
+
type: command.specWay,
|
|
51
|
+
error: _context.t0
|
|
52
|
+
});
|
|
53
|
+
} else if (globalCallback) {
|
|
54
|
+
globalCallback({
|
|
55
|
+
type: command.specWay,
|
|
56
|
+
error: _context.t0
|
|
57
|
+
});
|
|
58
|
+
}
|
|
45
59
|
case 16:
|
|
46
60
|
isProcessing = false;
|
|
47
61
|
_checkAndExecute();
|
|
@@ -68,7 +82,7 @@ var createCommandQueue = function createCommandQueue(specMethod) {
|
|
|
68
82
|
commandArray = [];
|
|
69
83
|
};
|
|
70
84
|
var listeners = function listeners(cb) {
|
|
71
|
-
|
|
85
|
+
globalCallback = cb;
|
|
72
86
|
};
|
|
73
87
|
return {
|
|
74
88
|
add: add,
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { initSpecifications, bleSpecQueue } from "./global.js";
|
|
2
|
+
import EcoService from "./main/EcoService.js";
|
|
3
|
+
import { addLog, LogPage } from "./main/log.js";
|
|
4
|
+
import { oneTrackReport, allTrackPoints } from './eco-track-report/index.js';
|
|
5
|
+
export { LogPage, addLog, bleSpecQueue, initSpecifications, EcoService, oneTrackReport, allTrackPoints };
|
package/lib/index.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bleSpec}from"./main/specMethod";var appName="",Device={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth)};import{initSpecifications,bleSpecQueue}from"./global.js";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log.js";import{oneTrackReport,allTrackPoints}from"./eco-track-report/index.js";import{bleSpec}from"./main/specMethod";appName="",Device={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth)};import{initSpecifications,bleSpecQueue}from"./global.js";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log.js";import{oneTrackReport,allTrackPoints}from"./eco-track-report/index.js";import{bleSpec}from"./main/specMethod";appName="",Device={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth)};import{initSpecifications,bleSpecQueue}from"./global.js";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log.js";import{oneTrackReport,allTrackPoints}from"./eco-track-report/index.js";export{appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints};
|
|
@@ -16,9 +16,11 @@ var log = function log(path, params, success, failure, logLevel) {
|
|
|
16
16
|
var header = nowDateString();
|
|
17
17
|
if (success != undefined) {
|
|
18
18
|
string = "[ApiRequest] : \u2705Success." + "\n\u8BF7\u6C42\u8DEF\u5F84: ".concat(path) + "\n\u8BF7\u6C42\u53C2\u6570: ".concat(JSON.stringify(params)) + "\n\u54CD\u5E94\u7ED3\u679C: ".concat(JSON.stringify(success));
|
|
19
|
+
console.log(string);
|
|
19
20
|
addLog("".concat(header, " : ").concat(string));
|
|
20
21
|
} else {
|
|
21
22
|
string = "[ApiRequest] : \u274CFailure." + "\n\u8BF7\u6C42\u8DEF\u5F84: ".concat(path) + "\n\u8BF7\u6C42\u53C2\u6570: ".concat(JSON.stringify(params)) + "\n\u54CD\u5E94\u7ED3\u679C: ".concat(JSON.stringify(failure));
|
|
23
|
+
console.log(string);
|
|
22
24
|
addLog("".concat(header, " : ").concat(string));
|
|
23
25
|
}
|
|
24
26
|
};
|
package/{main → lib/main}/log.js
RENAMED
|
@@ -5,12 +5,13 @@ var addLog = function addLog(string) {
|
|
|
5
5
|
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
6
6
|
if (data) {
|
|
7
7
|
LogUtil.setLogInfo("log->".concat(string).concat(JSON.stringify(data)));
|
|
8
|
-
console.log(
|
|
8
|
+
console.log("log->".concat(string).concat(JSON.stringify(data)));
|
|
9
9
|
} else {
|
|
10
10
|
LogUtil.setLogInfo("log->".concat(string));
|
|
11
|
-
console.log(
|
|
11
|
+
console.log("log->".concat(string));
|
|
12
12
|
}
|
|
13
13
|
if (appName === 'miwear-rn-plugin') {
|
|
14
|
+
console.log(localLog, "[ECO-rn]->".concat(string));
|
|
14
15
|
localLog(Device.model, "[ECO-rn]->".concat(string));
|
|
15
16
|
}
|
|
16
17
|
};
|
|
@@ -16,9 +16,11 @@ var log = function log(path, params, success, failure, logLevel) {
|
|
|
16
16
|
var header = nowDateString();
|
|
17
17
|
if (success != undefined) {
|
|
18
18
|
string = "[ApiRequest] : \u2705Success." + "\n\u8BF7\u6C42\u8DEF\u5F84: ".concat(path) + "\n\u8BF7\u6C42\u53C2\u6570: ".concat(JSON.stringify(params)) + "\n\u54CD\u5E94\u7ED3\u679C: ".concat(JSON.stringify(success));
|
|
19
|
+
console.log(string);
|
|
19
20
|
addLog("".concat(header, " : ").concat(string));
|
|
20
21
|
} else {
|
|
21
22
|
string = "[ApiRequest] : \u274CFailure." + "\n\u8BF7\u6C42\u8DEF\u5F84: ".concat(path) + "\n\u8BF7\u6C42\u53C2\u6570: ".concat(JSON.stringify(params)) + "\n\u54CD\u5E94\u7ED3\u679C: ".concat(JSON.stringify(failure));
|
|
23
|
+
console.log(string);
|
|
22
24
|
addLog("".concat(header, " : ").concat(string));
|
|
23
25
|
}
|
|
24
26
|
};
|
|
@@ -35,6 +35,7 @@ var LogPage = /*#__PURE__*/function (_LogComponent) {
|
|
|
35
35
|
key: "componentWillMount",
|
|
36
36
|
value: function componentWillMount() {
|
|
37
37
|
var logInfoArray = LogUtil.getLogInfo();
|
|
38
|
+
console.log('logInfoArray', logInfoArray);
|
|
38
39
|
// this.newFile(logInfoArray);
|
|
39
40
|
this.setState({
|
|
40
41
|
logInfo: logInfoArray
|
package/package.json
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eco-access-specifications",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "生态链公司插件接入规范,帮助生态链公司提高生产效率.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
7
|
+
"build": "babel src -d lib",
|
|
8
|
+
"obfuscate": "uglifyjs lib/*.js -o lib/index.min.js -m -c",
|
|
9
|
+
"prepare": "npm run build && npm run obfuscate"
|
|
8
10
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
+
"files": [
|
|
12
|
+
"lib/",
|
|
13
|
+
"index.js",
|
|
14
|
+
"package.json"
|
|
15
|
+
],
|
|
16
|
+
"author": "liuxu",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@babel/cli": "^7.25.9",
|
|
20
|
+
"@babel/preset-env": "^7.26.0",
|
|
21
|
+
"@babel/preset-react": "^7.25.9",
|
|
22
|
+
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
23
|
+
"javascript-obfuscator": "^4.1.1",
|
|
24
|
+
"uglify-js": "^3.19.3"
|
|
25
|
+
},
|
|
26
|
+
"private": false
|
|
11
27
|
}
|
package/index.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bleSpec}from"./main/specMethod";var appName="",Device={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth)};import{initSpecifications,bleSpecQueue}from"./global.js";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log.js";import{oneTrackReport,allTrackPoints}from"./eco-track-report/index.js";export{appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|