@mongodb-js/compass-utils 0.3.4 → 0.4.0

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.
@@ -4,7 +4,8 @@ export default mod;
4
4
  export const broadcast = mod.broadcast;
5
5
  export const cancellableWait = mod.cancellableWait;
6
6
  export const createCancelError = mod.createCancelError;
7
- export const getStoragePaths = mod.getStoragePaths;
7
+ export const getAppName = mod.getAppName;
8
+ export const getStoragePath = mod.getStoragePath;
8
9
  export const ipcExpose = mod.ipcExpose;
9
10
  export const ipcInvoke = mod.ipcInvoke;
10
11
  export const isCancelError = mod.isCancelError;
@@ -0,0 +1,3 @@
1
+ export declare function getAppName(): string | undefined;
2
+ export declare function getStoragePath(): string;
3
+ //# sourceMappingURL=electron.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electron.d.ts","sourceRoot":"","sources":["../src/electron.ts"],"names":[],"mappings":"AAmBA,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAE/C;AAED,wBAAgB,cAAc,WAM7B"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStoragePath = exports.getAppName = void 0;
4
+ function getElectronApp() {
5
+ let app;
6
+ try {
7
+ app = require('@electron/remote').app;
8
+ }
9
+ catch (e1) {
10
+ try {
11
+ app = require('electron').app;
12
+ }
13
+ catch (e2) {
14
+ console.log('Could not load @electron/remote', e1.message, e2.message);
15
+ }
16
+ }
17
+ return app;
18
+ }
19
+ function getAppName() {
20
+ return getElectronApp()?.getName();
21
+ }
22
+ exports.getAppName = getAppName;
23
+ function getStoragePath() {
24
+ const basepath = getElectronApp()?.getPath('userData');
25
+ if (!basepath) {
26
+ throw new Error('The storage path is not defined.');
27
+ }
28
+ return basepath;
29
+ }
30
+ exports.getStoragePath = getStoragePath;
31
+ //# sourceMappingURL=electron.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electron.js","sourceRoot":"","sources":["../src/electron.ts"],"names":[],"mappings":";;;AAEA,SAAS,cAAc;IACrB,IAAI,GAAG,CAAC;IAER,IAAI;QACF,GAAG,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC;KACvC;IAAC,OAAO,EAAO,EAAE;QAChB,IAAI;YACF,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC;SAC/B;QAAC,OAAO,EAAO,EAAE;YAEhB,OAAO,CAAC,GAAG,CAAC,iCAAiC,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC;SACxE;KACF;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,UAAU;IACxB,OAAO,cAAc,EAAE,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC;AAFD,gCAEC;AAED,SAAgB,cAAc;IAC5B,MAAM,QAAQ,GAAG,cAAc,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACvD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;KACrD;IACD,OAAO,QAAkB,CAAC;AAC5B,CAAC;AAND,wCAMC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { AmpersandMethodOptions, promisifyAmpersandMethod, } from './promisify-ampersand-method';
2
- export { StoragePaths, getStoragePaths } from './get-storage-paths';
2
+ export { getAppName, getStoragePath } from './electron';
3
3
  export { raceWithAbort, cancellableWait, createCancelError, isCancelError, throwIfAborted, } from './cancellable-promise';
4
4
  export { broadcast, ipcExpose, ipcInvoke } from './ipc';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EACL,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EACL,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC"}
package/dist/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ipcInvoke = exports.ipcExpose = exports.broadcast = exports.throwIfAborted = exports.isCancelError = exports.createCancelError = exports.cancellableWait = exports.raceWithAbort = exports.getStoragePaths = exports.promisifyAmpersandMethod = void 0;
3
+ exports.ipcInvoke = exports.ipcExpose = exports.broadcast = exports.throwIfAborted = exports.isCancelError = exports.createCancelError = exports.cancellableWait = exports.raceWithAbort = exports.getStoragePath = exports.getAppName = exports.promisifyAmpersandMethod = void 0;
4
4
  var promisify_ampersand_method_1 = require("./promisify-ampersand-method");
5
5
  Object.defineProperty(exports, "promisifyAmpersandMethod", { enumerable: true, get: function () { return promisify_ampersand_method_1.promisifyAmpersandMethod; } });
6
- var get_storage_paths_1 = require("./get-storage-paths");
7
- Object.defineProperty(exports, "getStoragePaths", { enumerable: true, get: function () { return get_storage_paths_1.getStoragePaths; } });
6
+ var electron_1 = require("./electron");
7
+ Object.defineProperty(exports, "getAppName", { enumerable: true, get: function () { return electron_1.getAppName; } });
8
+ Object.defineProperty(exports, "getStoragePath", { enumerable: true, get: function () { return electron_1.getStoragePath; } });
8
9
  var cancellable_promise_1 = require("./cancellable-promise");
9
10
  Object.defineProperty(exports, "raceWithAbort", { enumerable: true, get: function () { return cancellable_promise_1.raceWithAbort; } });
10
11
  Object.defineProperty(exports, "cancellableWait", { enumerable: true, get: function () { return cancellable_promise_1.cancellableWait; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2EAGsC;AADpC,sIAAA,wBAAwB,OAAA;AAE1B,yDAAoE;AAA7C,oHAAA,eAAe,OAAA;AACtC,6DAM+B;AAL7B,oHAAA,aAAa,OAAA;AACb,sHAAA,eAAe,OAAA;AACf,wHAAA,iBAAiB,OAAA;AACjB,oHAAA,aAAa,OAAA;AACb,qHAAA,cAAc,OAAA;AAEhB,6BAAwD;AAA/C,gGAAA,SAAS,OAAA;AAAE,gGAAA,SAAS,OAAA;AAAE,gGAAA,SAAS,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2EAGsC;AADpC,sIAAA,wBAAwB,OAAA;AAE1B,uCAAwD;AAA/C,sGAAA,UAAU,OAAA;AAAE,0GAAA,cAAc,OAAA;AACnC,6DAM+B;AAL7B,oHAAA,aAAa,OAAA;AACb,sHAAA,eAAe,OAAA;AACf,wHAAA,iBAAiB,OAAA;AACjB,oHAAA,aAAa,OAAA;AACb,qHAAA,cAAc,OAAA;AAEhB,6BAAwD;AAA/C,gGAAA,SAAS,OAAA;AAAE,gGAAA,SAAS,OAAA;AAAE,gGAAA,SAAS,OAAA"}
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "email": "compass@mongodb.com"
15
15
  },
16
16
  "homepage": "https://github.com/mongodb-js/compass",
17
- "version": "0.3.4",
17
+ "version": "0.4.0",
18
18
  "repository": {
19
19
  "type": "git",
20
20
  "url": "https://github.com/mongodb-js/compass.git"
@@ -51,12 +51,12 @@
51
51
  "reformat": "npm run prettier -- --write . && npm run eslint . --fix"
52
52
  },
53
53
  "optionalDependencies": {
54
- "@electron/remote": "^2.0.10",
55
- "electron": "^23.3.12"
54
+ "@electron/remote": "^2.0.11",
55
+ "electron": "^26.2.1"
56
56
  },
57
57
  "devDependencies": {
58
- "@mongodb-js/eslint-config-compass": "^1.0.8",
59
- "@mongodb-js/mocha-config-compass": "^1.3.0",
58
+ "@mongodb-js/eslint-config-compass": "^1.0.9",
59
+ "@mongodb-js/mocha-config-compass": "^1.3.1",
60
60
  "@mongodb-js/prettier-config-compass": "^1.0.1",
61
61
  "@mongodb-js/tsconfig-compass": "^1.0.3",
62
62
  "@types/chai": "^4.2.21",
@@ -72,5 +72,5 @@
72
72
  "sinon": "^9.2.3",
73
73
  "typescript": "^5.0.4"
74
74
  },
75
- "gitHead": "62acadaa32f014e73080cfaf7c15753e2e1db08f"
75
+ "gitHead": "146534300cc62674da9089cc7f8ebade832b359f"
76
76
  }
@@ -1,6 +0,0 @@
1
- export interface StoragePaths {
2
- appName: string;
3
- basepath: string;
4
- }
5
- export declare function getStoragePaths(): StoragePaths | undefined;
6
- //# sourceMappingURL=get-storage-paths.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-storage-paths.d.ts","sourceRoot":"","sources":["../src/get-storage-paths.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAmBD,wBAAgB,eAAe,IAAI,YAAY,GAAG,SAAS,CAQ1D"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStoragePaths = void 0;
4
- function getElectronApp() {
5
- let app;
6
- try {
7
- app = require('@electron/remote').app;
8
- }
9
- catch (e1) {
10
- try {
11
- app = require('electron').app;
12
- }
13
- catch (e2) {
14
- console.log('Could not load @electron/remote', e1.message, e2.message);
15
- }
16
- }
17
- return app;
18
- }
19
- function getStoragePaths() {
20
- const app = getElectronApp();
21
- if (!app)
22
- return undefined;
23
- const appName = app.getName();
24
- const basepath = app.getPath('userData');
25
- return { appName, basepath };
26
- }
27
- exports.getStoragePaths = getStoragePaths;
28
- //# sourceMappingURL=get-storage-paths.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-storage-paths.js","sourceRoot":"","sources":["../src/get-storage-paths.ts"],"names":[],"mappings":";;;AAMA,SAAS,cAAc;IACrB,IAAI,GAAG,CAAC;IAER,IAAI;QACF,GAAG,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC;KACvC;IAAC,OAAO,EAAO,EAAE;QAChB,IAAI;YACF,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC;SAC/B;QAAC,OAAO,EAAO,EAAE;YAEhB,OAAO,CAAC,GAAG,CAAC,iCAAiC,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC;SACxE;KACF;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,eAAe;IAC7B,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;IAC7B,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAE3B,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAC9B,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC/B,CAAC;AARD,0CAQC"}