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

@mongodb-js/compass-utils

Package Overview
Dependencies
Maintainers
0
Versions
472
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.0.0-next-c9014c9995a8d4a0e6e12cdf9244dc8230a2ee5e to 0.0.0-next-c96156ab322082d48c0b3957530744c30c1fc94a

15

dist/cancellable-promise.d.ts
declare class AbortError extends Error {
constructor();
constructor(message?: string);
name: string;
}
export declare const throwIfAborted: (signal?: AbortSignal) => void;
export declare const createCancelError: () => AbortError;
export declare const throwIfAborted: (signal?: {
aborted: boolean;
reason?: Error;
}) => void;
export declare const createCancelError: (message?: string) => AbortError;
export declare function isCancelError(error: any): error is AbortError;
export declare function raceWithAbort<T>(promise: Promise<T>, signal: AbortSignal): Promise<T>;
/**
* Returns a promise that waits for a timeout and can be canceled with a signal
*
* @param ms Wait time
* @param signal Abort signal
*/
export declare function cancellableWait(ms: number, signal: AbortSignal): Promise<void>;
export {};
//# sourceMappingURL=cancellable-promise.d.ts.map

25

dist/cancellable-promise.js

@@ -5,4 +5,4 @@ "use strict";

class AbortError extends Error {
constructor() {
super('This operation was aborted');
constructor(message) {
super(message ?? 'This operation was aborted');
this.name = 'AbortError';

@@ -17,6 +17,16 @@ }

exports.throwIfAborted = throwIfAborted;
const createCancelError = () => {
const createCancelError = (message) => {
const controller = new AbortController();
controller.abort();
return controller.signal.reason ?? new AbortError();
if (message && controller.signal.reason) {
Object.defineProperty(controller.signal.reason, 'message', {
get() {
return message;
},
configurable: true,
enumerable: true,
});
}
// .reason is not supported in all electron versions, so use AbortError as a fallback
return controller.signal.reason ?? new AbortError(message);
};

@@ -33,2 +43,3 @@ exports.createCancelError = createCancelError;

let abortListener;
// We need a promise that will reject as soon as the operation is aborted.
const pendingPromise = new Promise((_resolve, reject) => {

@@ -46,2 +57,8 @@ abortListener = () => reject(signal.reason ?? (0, exports.createCancelError)());

exports.raceWithAbort = raceWithAbort;
/**
* Returns a promise that waits for a timeout and can be canceled with a signal
*
* @param ms Wait time
* @param signal Abort signal
*/
async function cancellableWait(ms, signal) {

@@ -48,0 +65,0 @@ await raceWithAbort(new Promise((resolve) => {

export declare function getAppName(): string | undefined;
export declare function getAppVersion(): string | undefined;
export declare function getStoragePath(): string;
//# sourceMappingURL=electron.d.ts.map
"use strict";
/* eslint-disable @typescript-eslint/no-var-requires */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStoragePath = exports.getAppName = void 0;
exports.getStoragePath = exports.getAppVersion = exports.getAppName = void 0;
function getElectronApp() {

@@ -14,2 +15,3 @@ let app;

catch (e2) {
// eslint-disable-next-line no-console
console.log('Could not load @electron/remote', e1.message, e2.message);

@@ -24,2 +26,6 @@ }

exports.getAppName = getAppName;
function getAppVersion() {
return getElectronApp()?.getVersion();
}
exports.getAppVersion = getAppVersion;
function getStoragePath() {

@@ -26,0 +32,0 @@ const basepath = getElectronApp()?.getPath('userData');

@@ -1,5 +0,5 @@

export { AmpersandMethodOptions, promisifyAmpersandMethod, } from './promisify-ampersand-method';
export { getAppName, getStoragePath } from './electron';
export type { AmpersandMethodOptions } from './promisify-ampersand-method';
export { promisifyAmpersandMethod } from './promisify-ampersand-method';
export { getAppName, getStoragePath, getAppVersion } from './electron';
export { raceWithAbort, cancellableWait, createCancelError, isCancelError, throwIfAborted, } from './cancellable-promise';
export { broadcast, ipcExpose, ipcInvoke } from './ipc';
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ipcInvoke = exports.ipcExpose = exports.broadcast = exports.throwIfAborted = exports.isCancelError = exports.createCancelError = exports.cancellableWait = exports.raceWithAbort = exports.getStoragePath = exports.getAppName = exports.promisifyAmpersandMethod = void 0;
exports.throwIfAborted = exports.isCancelError = exports.createCancelError = exports.cancellableWait = exports.raceWithAbort = exports.getAppVersion = exports.getStoragePath = exports.getAppName = exports.promisifyAmpersandMethod = void 0;
var promisify_ampersand_method_1 = require("./promisify-ampersand-method");

@@ -9,2 +9,3 @@ Object.defineProperty(exports, "promisifyAmpersandMethod", { enumerable: true, get: function () { return promisify_ampersand_method_1.promisifyAmpersandMethod; } });

Object.defineProperty(exports, "getStoragePath", { enumerable: true, get: function () { return electron_1.getStoragePath; } });
Object.defineProperty(exports, "getAppVersion", { enumerable: true, get: function () { return electron_1.getAppVersion; } });
var cancellable_promise_1 = require("./cancellable-promise");

@@ -16,6 +17,2 @@ Object.defineProperty(exports, "raceWithAbort", { enumerable: true, get: function () { return cancellable_promise_1.raceWithAbort; } });

Object.defineProperty(exports, "throwIfAborted", { enumerable: true, get: function () { return cancellable_promise_1.throwIfAborted; } });
var ipc_1 = require("./ipc");
Object.defineProperty(exports, "broadcast", { enumerable: true, get: function () { return ipc_1.broadcast; } });
Object.defineProperty(exports, "ipcExpose", { enumerable: true, get: function () { return ipc_1.ipcExpose; } });
Object.defineProperty(exports, "ipcInvoke", { enumerable: true, get: function () { return ipc_1.ipcInvoke; } });
//# sourceMappingURL=index.js.map
{
"name": "@mongodb-js/compass-utils",
"productName": "compass-utils Plugin",
"description": "Utilities for MongoDB Compass Development",

@@ -17,3 +16,3 @@ "author": {

"homepage": "https://github.com/mongodb-js/compass",
"version": "0.0.0-next-c9014c9995a8d4a0e6e12cdf9244dc8230a2ee5e",
"version": "0.0.0-next-c96156ab322082d48c0b3957530744c30c1fc94a",
"repository": {

@@ -39,3 +38,3 @@ "type": "git",

"bootstrap": "npm run compile",
"prepublishOnly": "npm run compile",
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
"compile": "tsc -p tsconfig.json && gen-esm-wrapper . ./dist/.esm-wrapper.mjs",

@@ -46,3 +45,3 @@ "typecheck": "tsc -p tsconfig-lint.json --noEmit",

"lint": "npm run eslint . && npm run prettier -- --check .",
"depcheck": "depcheck",
"depcheck": "compass-scripts check-peer-deps && depcheck",
"check": "npm run typecheck && npm run lint && npm run depcheck",

@@ -54,13 +53,9 @@ "check-ci": "npm run check",

"test-ci": "npm run test-cov",
"reformat": "npm run prettier -- --write . && npm run eslint . --fix"
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
},
"optionalDependencies": {
"@electron/remote": "^2.0.11",
"electron": "^26.2.1"
},
"devDependencies": {
"@mongodb-js/eslint-config-compass": "0.0.0-next-c9014c9995a8d4a0e6e12cdf9244dc8230a2ee5e",
"@mongodb-js/mocha-config-compass": "0.0.0-next-c9014c9995a8d4a0e6e12cdf9244dc8230a2ee5e",
"@mongodb-js/prettier-config-compass": "0.0.0-next-c9014c9995a8d4a0e6e12cdf9244dc8230a2ee5e",
"@mongodb-js/tsconfig-compass": "0.0.0-next-c9014c9995a8d4a0e6e12cdf9244dc8230a2ee5e",
"@mongodb-js/eslint-config-compass": "0.0.0-next-c96156ab322082d48c0b3957530744c30c1fc94a",
"@mongodb-js/mocha-config-compass": "0.0.0-next-c96156ab322082d48c0b3957530744c30c1fc94a",
"@mongodb-js/prettier-config-compass": "0.0.0-next-c96156ab322082d48c0b3957530744c30c1fc94a",
"@mongodb-js/tsconfig-compass": "0.0.0-next-c96156ab322082d48c0b3957530744c30c1fc94a",
"@types/chai": "^4.2.21",

@@ -79,3 +74,7 @@ "@types/mocha": "^9.0.0",

},
"gitHead": "c9014c9995a8d4a0e6e12cdf9244dc8230a2ee5e"
"dependencies": {
"@electron/remote": "^2.1.2",
"electron": "^32.2.3"
},
"gitHead": "c96156ab322082d48c0b3957530744c30c1fc94a"
}

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

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