@abtnode/analytics 1.16.30-beta-958ae719 → 1.16.30-beta-b80c7bcd
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/index.js +8 -9
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -3,7 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getGoAccessBinary = getGoAccessBinary;
|
|
7
|
+
exports.decompressLog = decompressLog;
|
|
8
|
+
exports.splitLogByGroup = splitLogByGroup;
|
|
9
|
+
exports.processLogForGroup = processLogForGroup;
|
|
10
|
+
exports.hasLogByDate = hasLogByDate;
|
|
11
|
+
exports.processLogByDate = processLogByDate;
|
|
12
|
+
exports.getHtmlResultPath = getHtmlResultPath;
|
|
13
|
+
exports.getJsonResultPath = getJsonResultPath;
|
|
7
14
|
/* eslint-disable @typescript-eslint/comma-dangle */
|
|
8
15
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
16
|
const path_1 = __importDefault(require("path"));
|
|
@@ -31,7 +38,6 @@ function getGoAccessBinary() {
|
|
|
31
38
|
const { stdout } = shelljs_1.default.which('goaccess') || { stdout: '' };
|
|
32
39
|
return stdout.trim();
|
|
33
40
|
}
|
|
34
|
-
exports.getGoAccessBinary = getGoAccessBinary;
|
|
35
41
|
async function decompressLog(source, tmpDir) {
|
|
36
42
|
fs_extra_1.default.ensureDirSync(tmpDir);
|
|
37
43
|
const dest = path_1.default.join(tmpDir, path_1.default.basename(source, '.gz'));
|
|
@@ -41,7 +47,6 @@ async function decompressLog(source, tmpDir) {
|
|
|
41
47
|
await tar_1.default.x({ file: source, C: tmpDir });
|
|
42
48
|
return dest;
|
|
43
49
|
}
|
|
44
|
-
exports.decompressLog = decompressLog;
|
|
45
50
|
function splitLogByGroup(filePath, dataDir, date, groups) {
|
|
46
51
|
return Promise.all(groups.map(async (group) => {
|
|
47
52
|
if (group.type === 'server') {
|
|
@@ -66,7 +71,6 @@ function splitLogByGroup(filePath, dataDir, date, groups) {
|
|
|
66
71
|
return group;
|
|
67
72
|
}));
|
|
68
73
|
}
|
|
69
|
-
exports.splitLogByGroup = splitLogByGroup;
|
|
70
74
|
async function processLogForGroup(dataDir, date, group) {
|
|
71
75
|
try {
|
|
72
76
|
const groupDir = path_1.default.join(dataDir, group.did, ANALYTICS_DIR);
|
|
@@ -97,12 +101,10 @@ async function processLogForGroup(dataDir, date, group) {
|
|
|
97
101
|
}
|
|
98
102
|
return group;
|
|
99
103
|
}
|
|
100
|
-
exports.processLogForGroup = processLogForGroup;
|
|
101
104
|
function hasLogByDate(logDir, date) {
|
|
102
105
|
const compressed = path_1.default.join(logDir, `access-${date}.log.gz`);
|
|
103
106
|
return fs_extra_1.default.existsSync(compressed);
|
|
104
107
|
}
|
|
105
|
-
exports.hasLogByDate = hasLogByDate;
|
|
106
108
|
async function processLogByDate(logDir, tmpDir, dataDir, date, groups) {
|
|
107
109
|
const binary = getGoAccessBinary();
|
|
108
110
|
if (!binary) {
|
|
@@ -120,12 +122,9 @@ async function processLogByDate(logDir, tmpDir, dataDir, date, groups) {
|
|
|
120
122
|
fs_extra_1.default.removeSync(decompressed);
|
|
121
123
|
return results;
|
|
122
124
|
}
|
|
123
|
-
exports.processLogByDate = processLogByDate;
|
|
124
125
|
function getHtmlResultPath(dataDir, date, did) {
|
|
125
126
|
return path_1.default.join(dataDir, did, ANALYTICS_DIR, `${date}.html`);
|
|
126
127
|
}
|
|
127
|
-
exports.getHtmlResultPath = getHtmlResultPath;
|
|
128
128
|
function getJsonResultPath(dataDir, date, did) {
|
|
129
129
|
return path_1.default.join(dataDir, did, ANALYTICS_DIR, `${date}.json`);
|
|
130
130
|
}
|
|
131
|
-
exports.getJsonResultPath = getJsonResultPath;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.30-beta-
|
|
6
|
+
"version": "1.16.30-beta-b80c7bcd",
|
|
7
7
|
"description": "Lib to help blocklet developers to get insights of their blocklet",
|
|
8
8
|
"main": "index.js",
|
|
9
9
|
"files": [
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@abtnode/util": "1.16.30-beta-
|
|
25
|
+
"@abtnode/util": "1.16.30-beta-b80c7bcd",
|
|
26
26
|
"debug": "^4.3.4",
|
|
27
27
|
"fs-extra": "^11.2.0",
|
|
28
28
|
"shelljs": "^0.8.5",
|
|
29
29
|
"tar": "^6.1.11"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@abtnode/types": "1.16.30-beta-
|
|
32
|
+
"@abtnode/types": "1.16.30-beta-b80c7bcd",
|
|
33
33
|
"@arcblock/eslint-config-ts": "^0.3.2",
|
|
34
34
|
"@types/jest": "^29.5.11",
|
|
35
35
|
"@types/node": "^20.12.2",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"ts-jest": "^29.1.1",
|
|
42
42
|
"typescript": "^5.0.4"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "9d68833290b1a59357b7c362018416b82b5d1503"
|
|
45
45
|
}
|