Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mongodb-js/compass-logging

Package Overview
Dependencies
Maintainers
0
Versions
493
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mongodb-js/compass-logging - npm Package Compare versions

Comparing version 0.0.0-next-0d9e77c42a99b49fd4ecc7167d0c769866f92ef2 to 0.0.0-next-0df16eac622fa26bc26ea5bc44d4af849a08e128

dist/ipc-logger.d.ts

14

dist/index.d.ts

@@ -1,12 +0,6 @@

import { MongoLogWriter, mongoLogId } from 'mongodb-log-writer';
export { createLogger } from './ipc-logger';
export type { Logger } from './logger';
export { mongoLogId } from 'mongodb-log-writer';
import createDebug from 'debug';
declare type TrackProps = Record<string, any> | (() => Record<string, any>);
declare type TrackFunction = (event: string, properties?: TrackProps) => void;
export declare function createLoggerAndTelemetry(component: string): {
log: ReturnType<MongoLogWriter['bindComponent']>;
mongoLogId: typeof mongoLogId;
debug: ReturnType<typeof createDebug>;
track: TrackFunction;
};
export default createLoggerAndTelemetry;
export declare const debug: createDebug.Debugger;
//# sourceMappingURL=index.d.ts.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -29,87 +6,9 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
exports.createLoggerAndTelemetry = void 0;
const mongodb_log_writer_1 = require("mongodb-log-writer");
const is_electron_renderer_1 = __importDefault(require("is-electron-renderer"));
exports.debug = exports.mongoLogId = exports.createLogger = void 0;
var ipc_logger_1 = require("./ipc-logger");
Object.defineProperty(exports, "createLogger", { enumerable: true, get: function () { return ipc_logger_1.createLogger; } });
var mongodb_log_writer_1 = require("mongodb-log-writer");
Object.defineProperty(exports, "mongoLogId", { enumerable: true, get: function () { return mongodb_log_writer_1.mongoLogId; } });
const debug_1 = __importDefault(require("debug"));
let preferences;
function emit(ipc, event, data) {
var _a;
void ((_a = ipc === null || ipc === void 0 ? void 0 : ipc.callQuiet) === null || _a === void 0 ? void 0 : _a.call(ipc, event, data));
if (typeof process !== 'undefined' && typeof process.emit === 'function') {
process.emit(event, data);
}
}
function createLoggerAndTelemetry(component) {
const ipc = is_electron_renderer_1.default
? require('hadron-ipc')
: null;
const target = {
write(line, callback) {
emit(ipc, 'compass:log', { line });
callback();
},
end(callback) {
callback();
},
};
const writer = new mongodb_log_writer_1.MongoLogWriter('', null, target);
const track = (...args) => {
void Promise.resolve()
.then(() => trackAsync(...args))
.catch((error) => debug('track failed', error));
};
const trackAsync = async (event, properties = {}) => {
try {
preferences !== null && preferences !== void 0 ? preferences : (preferences = (await Promise.resolve().then(() => __importStar(require('compass-preferences-model'))))
.preferencesAccess);
}
catch (_a) {
preferences !== null && preferences !== void 0 ? preferences : (preferences = {
getPreferences() {
return { trackUsageStatistics: true };
},
});
}
const { trackUsageStatistics = true } = preferences === null || preferences === void 0 ? void 0 : preferences.getPreferences();
if (!trackUsageStatistics) {
return;
}
const data = {
event,
properties,
};
if (typeof properties === 'function') {
try {
data.properties = await properties();
}
catch (error) {
emit(ipc, 'compass:track', {
event: 'Error Fetching Attributes',
properties: {
event_name: event,
},
});
return;
}
}
emit(ipc, 'compass:track', data);
};
const debug = (0, debug_1.default)(`mongodb-compass:${component.toLowerCase()}`);
writer.on('log', ({ s, ctx, msg, attr }) => {
if (attr) {
debug(msg, { s, ctx, ...attr });
}
else {
debug(msg, { s, ctx });
}
});
return {
log: writer.bindComponent(component),
mongoLogId: mongodb_log_writer_1.mongoLogId,
debug,
track,
};
}
exports.createLoggerAndTelemetry = createLoggerAndTelemetry;
exports.default = createLoggerAndTelemetry;
exports.debug = (0, debug_1.default)('mongodb-compass');
//# sourceMappingURL=index.js.map

@@ -16,3 +16,3 @@ {

"homepage": "https://github.com/mongodb-js/compass",
"version": "0.0.0-next-0d9e77c42a99b49fd4ecc7167d0c769866f92ef2",
"version": "0.0.0-next-0df16eac622fa26bc26ea5bc44d4af849a08e128",
"repository": {

@@ -23,12 +23,15 @@ "type": "git",

"files": [
"dist"
"dist",
"provider.js"
],
"license": "SSPL",
"peerDependencies": {
"hadron-ipc": "^3.1.0"
"main": "dist/index.js",
"exports": {
".": "./dist/index.js",
"./provider": "./dist/provider.js"
},
"main": "dist/index.js",
"compass:main": "src/index.ts",
"compass:exports": {
".": "./src/index.ts"
".": "./src/index.ts",
"./provider": "./src/provider.ts"
},

@@ -43,22 +46,26 @@ "types": "./dist/index.d.ts",

"lint": "npm run eslint . && npm run prettier -- --check .",
"depcheck": "depcheck",
"depcheck": "compass-scripts check-peer-deps && depcheck",
"check": "npm run lint && npm run depcheck",
"check-ci": "npm run check",
"test": "mocha",
"test-cov": "nyc -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test",
"test-cov": "nyc --compact=false --produce-source-map=false -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test",
"test-watch": "npm run test -- --watch",
"test-ci": "npm run test-cov",
"reformat": "npm run prettier -- --write ."
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
},
"dependencies": {
"debug": "^4.2.0",
"debug": "^4.3.4",
"hadron-app-registry": "0.0.0-next-0df16eac622fa26bc26ea5bc44d4af849a08e128",
"hadron-ipc": "0.0.0-next-0df16eac622fa26bc26ea5bc44d4af849a08e128",
"is-electron-renderer": "^2.0.1",
"mongodb-log-writer": "^1.1.4"
"mongodb-log-writer": "^1.4.2",
"react": "^17.0.2"
},
"devDependencies": {
"@mongodb-js/eslint-config-compass": "0.0.0-next-0d9e77c42a99b49fd4ecc7167d0c769866f92ef2",
"@mongodb-js/mocha-config-compass": "0.0.0-next-0d9e77c42a99b49fd4ecc7167d0c769866f92ef2",
"@mongodb-js/prettier-config-compass": "0.0.0-next-0d9e77c42a99b49fd4ecc7167d0c769866f92ef2",
"@mongodb-js/tsconfig-compass": "0.0.0-next-0d9e77c42a99b49fd4ecc7167d0c769866f92ef2",
"@mongodb-js/eslint-config-compass": "0.0.0-next-0df16eac622fa26bc26ea5bc44d4af849a08e128",
"@mongodb-js/mocha-config-compass": "0.0.0-next-0df16eac622fa26bc26ea5bc44d4af849a08e128",
"@mongodb-js/prettier-config-compass": "0.0.0-next-0df16eac622fa26bc26ea5bc44d4af849a08e128",
"@mongodb-js/tsconfig-compass": "0.0.0-next-0df16eac622fa26bc26ea5bc44d4af849a08e128",
"@types/chai": "^4.2.21",
"@types/debug": "^4.1.9",
"@types/mocha": "^9.0.0",

@@ -69,8 +76,7 @@ "@types/sinon-chai": "^3.2.5",

"eslint": "^7.25.0",
"hadron-ipc": "0.0.0-next-0d9e77c42a99b49fd4ecc7167d0c769866f92ef2",
"mocha": "^8.4.0",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"prettier": "^2.7.1",
"sinon": "^9.2.3",
"typescript": "^4.8.3"
"typescript": "^5.0.4"
},

@@ -80,3 +86,3 @@ "optionalPeerDependencies": {

},
"gitHead": "0d9e77c42a99b49fd4ecc7167d0c769866f92ef2"
"gitHead": "0df16eac622fa26bc26ea5bc44d4af849a08e128"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc