@aspecto/core
Advanced tools
Comparing version 1.1.18 to 1.1.19
@@ -12,2 +12,3 @@ "use strict"; | ||
}; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -20,2 +21,3 @@ const os = __importStar(require("os")); | ||
const IdCollector_1 = __importDefault(require("./IdCollector")); | ||
const aspectoVersion = (_a = require('../../package.json')) === null || _a === void 0 ? void 0 : _a.version; | ||
class Collector { | ||
@@ -52,2 +54,3 @@ constructor(ws, packageName, packageVersion) { | ||
data.packageVersion = Collector.packageVersion; | ||
data.aspectoVersion = aspectoVersion; | ||
data.id = this.id; | ||
@@ -54,0 +57,0 @@ data.gitHash = (_b = (_a = GitCollector_1.default.hash, (_a !== null && _a !== void 0 ? _a : IdCollector_1.default.id)), (_b !== null && _b !== void 0 ? _b : undefined)); |
@@ -15,49 +15,48 @@ "use strict"; | ||
try { | ||
try { | ||
const readFileSync = dynamic_require_1.fs().readFileSync; | ||
const rootPath = aspectoConfig_1.default.getLinkedRootFolder(); | ||
const rev = readFileSync(`${rootPath}.git/HEAD`) | ||
.toString() | ||
.trim(); | ||
if (rev.indexOf(':') === -1) { | ||
GITCollector.hash = rev; | ||
return rev; | ||
} | ||
else { | ||
let hash = readFileSync(`${rootPath}.git/${rev.substring(5).replace('\n', '')}`) | ||
.toString() | ||
.replace('\n', '') | ||
.trim(); | ||
GITCollector.hash = hash; | ||
return hash; | ||
} | ||
const readFileSync = dynamic_require_1.fs().readFileSync; | ||
const rootPath = aspectoConfig_1.default.getLinkedRootFolder(); | ||
const rev = readFileSync(`${rootPath}.git/HEAD`) | ||
.toString() | ||
.trim(); | ||
if (rev.indexOf(':') === -1) { | ||
GITCollector.hash = rev; | ||
return rev; | ||
} | ||
catch (e1) { | ||
// console.log(e1); | ||
} | ||
let gitData = undefined; | ||
try { | ||
gitData = dynamic_require_1.child_process() | ||
.execSync('git rev-parse HEAD', { stdio: 'ignore' }) | ||
else { | ||
let hash = readFileSync(`${rootPath}.git/${rev.substring(5).replace('\n', '')}`) | ||
.toString() | ||
.replace('\n', '') | ||
.trim(); | ||
GITCollector.hash = gitData; | ||
GITCollector.hash = hash; | ||
return hash; | ||
} | ||
catch (e2) { | ||
try { | ||
gitData = dynamic_require_1.child_process() | ||
.execSync('git rev-parse HEAD') | ||
.toString() | ||
.trim(); | ||
GITCollector.hash = gitData; | ||
} | ||
catch (e3) { } | ||
} | ||
} | ||
catch (e1) { | ||
// console.log('e1', e1); | ||
} | ||
try { | ||
const gitData = dynamic_require_1.child_process() | ||
.execSync('git rev-parse HEAD', { stdio: 'ignore' }) | ||
.toString() | ||
.trim(); | ||
GITCollector.hash = gitData; | ||
return gitData; | ||
} | ||
catch (e) { | ||
const id = aspectoConfig_1.default.getNPMPostInstallId(); | ||
GITCollector.hash = id; | ||
return; | ||
catch (e2) { | ||
// console.log('e2', e2); | ||
} | ||
try { | ||
const gitData = dynamic_require_1.child_process() | ||
.execSync('git rev-parse HEAD') | ||
.toString() | ||
.trim(); | ||
GITCollector.hash = gitData; | ||
return gitData; | ||
} | ||
catch (e3) { | ||
// console.log('e3', e3); | ||
} | ||
const id = aspectoConfig_1.default.getNPMPostInstallId(); | ||
GITCollector.hash = id; | ||
return id; | ||
} | ||
@@ -64,0 +63,0 @@ getKey() { |
@@ -1,3 +0,1 @@ | ||
export declare const WebSocketHost = "wss://ws.topsight.io"; | ||
export declare const AuthHost = "https://auth.topsight.io"; | ||
export declare const ConfigHost: string; | ||
@@ -4,0 +2,0 @@ export { isNode } from './isNode'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WebSocketHost = 'wss://ws.topsight.io'; | ||
exports.AuthHost = 'https://auth.topsight.io'; | ||
exports.ConfigHost = process.env.NODE_ENV !== 'aspc_dev' ? 'https://config.aspecto.io' : 'http://localhost:8085/'; | ||
exports.ConfigHost = process.env.ASPECTO_CONFIG_HOST || | ||
(process.env.NODE_ENV !== 'aspc_dev' ? 'https://config.aspecto.io' : 'http://localhost:8085/'); | ||
var isNode_1 = require("./isNode"); | ||
@@ -7,0 +6,0 @@ exports.isNode = isNode_1.isNode; |
@@ -20,3 +20,3 @@ "use strict"; | ||
const GitCollector_1 = __importDefault(require("./collection/GitCollector")); | ||
const HttpReporter_1 = __importDefault(require("./reporters/HttpReporter")); | ||
const ExpressReporter_1 = __importDefault(require("./reporters/ExpressReporter")); | ||
const NodeHttpReporter_1 = __importDefault(require("./reporters/NodeHttpReporter")); | ||
@@ -41,3 +41,3 @@ const aspectoConfig_1 = __importDefault(require("./config/aspectoConfig")); | ||
if (config_1.isNode) { | ||
reporters.push(new HttpReporter_1.default()); | ||
reporters.push(new ExpressReporter_1.default()); | ||
reporters.push(new ErrorReporter_1.default()); | ||
@@ -44,0 +44,0 @@ if (((_c = options) === null || _c === void 0 ? void 0 : _c.outgoing) !== false) { |
@@ -9,4 +9,4 @@ import WebSocketConnection from '../communication/ws'; | ||
private initPrivacyEngine; | ||
sendData(nodeErrorData: any): void; | ||
sendData(report: any): void; | ||
set(ws: WebSocketConnection, token: string): void; | ||
} |
@@ -34,3 +34,3 @@ "use strict"; | ||
} | ||
sendData(nodeErrorData) { | ||
sendData(report) { | ||
var _a, _b; | ||
@@ -43,3 +43,3 @@ // do not send anything until we initialize privacy rules | ||
data.token = BaseReporter.token; | ||
data[this.getKey()] = nodeErrorData; | ||
data[this.getKey()] = report; | ||
if (BlacklistMatcher_1.default.match(data)) | ||
@@ -46,0 +46,0 @@ return; |
{ | ||
"name": "@aspecto/core", | ||
"version": "1.1.18", | ||
"version": "1.1.19", | ||
"description": "Aspecto metric collector", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -5,5 +5,2 @@ # Aspecto | ||
![alt text](https://logo.topsight.io/breaking-change-hover.png "Aspecto IDE example") | ||
## How it works | ||
@@ -17,7 +14,4 @@ - Install this package - it will report to our servers | ||
--- | ||
## Start using | ||
#### Install #### | ||
#### Install | ||
@@ -35,3 +29,2 @@ ``` | ||
- In the root folder create a aspecto.json file with {"token" : "-- token goes here --"} | ||
- You can get your token from [here](https://app.aspecto.io/) | ||
@@ -38,0 +31,0 @@ |
@@ -6,3 +6,5 @@ const fs = require('fs'); | ||
const data = { id: id.trim() }; | ||
fs.writeFileSync(`${process.cwd()}/dist/id.json`, JSON.stringify(data)); | ||
const dir = process.argv[2] || 'dist'; | ||
const filePath = `${process.cwd()}/${dir}/id.json`; | ||
fs.writeFileSync(filePath, JSON.stringify(data)); | ||
console.log(`Created Aspecto identifier ${id}`); | ||
@@ -39,3 +41,3 @@ } | ||
} catch (err) { | ||
console.log('Failed generating aspecto identifier'); | ||
console.log('Failed generating aspecto identifier', err); | ||
} | ||
@@ -42,0 +44,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
88242
83
1372
32
13