@mongodb-js/connection-info 0.6.0 → 0.7.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.
- package/dist/connection-info.d.ts +2 -2
- package/dist/connection-info.d.ts.map +1 -1
- package/dist/connection-title.d.ts +3 -1
- package/dist/connection-title.d.ts.map +1 -1
- package/dist/connection-title.js +18 -9
- package/dist/connection-title.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
|
@@ -6,12 +6,13 @@ export interface AtlasClusterMetadata {
|
|
|
6
6
|
clusterName: string;
|
|
7
7
|
clusterType: 'host' | 'replicaSet' | 'cluster' | 'serverless';
|
|
8
8
|
regionalBaseUrl: string;
|
|
9
|
+
instanceSize?: string;
|
|
9
10
|
}
|
|
10
11
|
export interface ConnectionInfo {
|
|
11
12
|
readonly id: string;
|
|
12
13
|
lastUsed?: Date;
|
|
13
14
|
favorite?: ConnectionFavoriteOptions;
|
|
14
|
-
savedConnectionType?: 'favorite' | 'recent'
|
|
15
|
+
savedConnectionType?: 'favorite' | 'recent';
|
|
15
16
|
connectionOptions: ConnectionOptions;
|
|
16
17
|
atlasMetadata?: AtlasClusterMetadata;
|
|
17
18
|
}
|
|
@@ -19,5 +20,4 @@ export interface ConnectionFavoriteOptions {
|
|
|
19
20
|
name: string;
|
|
20
21
|
color?: string;
|
|
21
22
|
}
|
|
22
|
-
export type ConnectionStatus = 'connected' | 'disconnected' | 'connecting' | 'failed';
|
|
23
23
|
//# sourceMappingURL=connection-info.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-info.d.ts","sourceRoot":"","sources":["../src/connection-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IAMd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,CAAC;IAC9D,eAAe,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"connection-info.d.ts","sourceRoot":"","sources":["../src/connection-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IAMd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,CAAC;IAC9D,eAAe,EAAE,MAAM,CAAC;IAMxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAI7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAKpB,QAAQ,CAAC,EAAE,IAAI,CAAC;IAKhB,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IAMrC,mBAAmB,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IAK5C,iBAAiB,EAAE,iBAAiB,CAAC;IAKrC,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAED,MAAM,WAAW,yBAAyB;IAIxC,IAAI,EAAE,MAAM,CAAC;IAKb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { ConnectionInfo } from './connection-info';
|
|
2
|
-
|
|
2
|
+
type ConnectionInfoForTitle = Pick<ConnectionInfo, 'favorite' | 'connectionOptions' | 'atlasMetadata'>;
|
|
3
|
+
export declare function getConnectionTitle(info: ConnectionInfoForTitle): string;
|
|
4
|
+
export {};
|
|
3
5
|
//# sourceMappingURL=connection-title.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-title.d.ts","sourceRoot":"","sources":["../src/connection-title.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,
|
|
1
|
+
{"version":3,"file":"connection-title.d.ts","sourceRoot":"","sources":["../src/connection-title.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,KAAK,sBAAsB,GAAG,IAAI,CAChC,cAAc,EACd,UAAU,GAAG,mBAAmB,GAAG,eAAe,CACnD,CAAC;AASF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAuBvE"}
|
package/dist/connection-title.js
CHANGED
|
@@ -5,20 +5,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getConnectionTitle = void 0;
|
|
7
7
|
const mongodb_connection_string_url_1 = __importDefault(require("mongodb-connection-string-url"));
|
|
8
|
+
const ConnectionInfoTitleCache = new WeakMap();
|
|
8
9
|
function getConnectionTitle(info) {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
let title = ConnectionInfoTitleCache.get(info);
|
|
11
|
+
if (title) {
|
|
12
|
+
return title;
|
|
11
13
|
}
|
|
12
|
-
if (info.
|
|
13
|
-
|
|
14
|
+
if (info.atlasMetadata?.clusterName) {
|
|
15
|
+
title = info.atlasMetadata.clusterName;
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return url.hosts.join(',');
|
|
17
|
+
else if (info.favorite?.name) {
|
|
18
|
+
title = info.favorite.name;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
else {
|
|
21
|
+
try {
|
|
22
|
+
const url = new mongodb_connection_string_url_1.default(info.connectionOptions.connectionString);
|
|
23
|
+
title = url.hosts.join(',');
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
title = info.connectionOptions.connectionString || 'Connection';
|
|
27
|
+
}
|
|
21
28
|
}
|
|
29
|
+
ConnectionInfoTitleCache.set(info, title);
|
|
30
|
+
return title;
|
|
22
31
|
}
|
|
23
32
|
exports.getConnectionTitle = getConnectionTitle;
|
|
24
33
|
//# sourceMappingURL=connection-title.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-title.js","sourceRoot":"","sources":["../src/connection-title.ts"],"names":[],"mappings":";;;;;;AAAA,kGAA6D;
|
|
1
|
+
{"version":3,"file":"connection-title.js","sourceRoot":"","sources":["../src/connection-title.ts"],"names":[],"mappings":";;;;;;AAAA,kGAA6D;AAQ7D,MAAM,wBAAwB,GAAG,IAAI,OAAO,EAAkC,CAAC;AAO/E,SAAgB,kBAAkB,CAAC,IAA4B;IAC7D,IAAI,KAAK,GAAG,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAE/C,IAAI,KAAK,EAAE;QACT,OAAO,KAAK,CAAC;KACd;IAED,IAAI,IAAI,CAAC,aAAa,EAAE,WAAW,EAAE;QACnC,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC;KACxC;SAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE;QAC9B,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;KAC5B;SAAM;QACL,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,uCAAgB,CAAC,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;YAC1E,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAC7B;QAAC,OAAO,CAAC,EAAE;YAEV,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,IAAI,YAAY,CAAC;SACjE;KACF;IAED,wBAAwB,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1C,OAAO,KAAK,CAAC;AACf,CAAC;AAvBD,gDAuBC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { ConnectionSecrets } from './connection-secrets';
|
|
2
2
|
export { extractSecrets, mergeSecrets } from './connection-secrets';
|
|
3
|
-
export type { ConnectionInfo, ConnectionFavoriteOptions,
|
|
3
|
+
export type { ConnectionInfo, ConnectionFavoriteOptions, AtlasClusterMetadata, } from './connection-info';
|
|
4
4
|
export { getConnectionTitle } from './connection-title';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,YAAY,EACV,cAAc,EACd,yBAAyB,EACzB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,YAAY,EACV,cAAc,EACd,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,2DAAoE;AAA3D,oHAAA,cAAc,OAAA;AAAE,kHAAA,YAAY,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,2DAAoE;AAA3D,oHAAA,cAAc,OAAA;AAAE,kHAAA,YAAY,OAAA;AAMrC,uDAAwD;AAA/C,sHAAA,kBAAkB,OAAA"}
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"email": "compass@mongodb.com"
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/mongodb-js/compass",
|
|
16
|
-
"version": "0.
|
|
16
|
+
"version": "0.7.0",
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
19
|
"url": "https://github.com/mongodb-js/compass.git"
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"main": "dist/index.js",
|
|
26
26
|
"compass:main": "src/index.ts",
|
|
27
27
|
"exports": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
28
29
|
"import": "./dist/.esm-wrapper.mjs",
|
|
29
30
|
"require": "./dist/index.js"
|
|
30
31
|
},
|
|
@@ -53,11 +54,11 @@
|
|
|
53
54
|
"lodash": "^4.17.21",
|
|
54
55
|
"mongodb": "^6.8.0",
|
|
55
56
|
"mongodb-connection-string-url": "^3.0.1",
|
|
56
|
-
"mongodb-data-service": "^22.23.
|
|
57
|
+
"mongodb-data-service": "^22.23.2"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
|
-
"@mongodb-js/eslint-config-compass": "^1.1.
|
|
60
|
-
"@mongodb-js/mocha-config-compass": "^1.4.
|
|
60
|
+
"@mongodb-js/eslint-config-compass": "^1.1.6",
|
|
61
|
+
"@mongodb-js/mocha-config-compass": "^1.4.1",
|
|
61
62
|
"@mongodb-js/prettier-config-compass": "^1.0.2",
|
|
62
63
|
"@mongodb-js/tsconfig-compass": "^1.0.4",
|
|
63
64
|
"@types/chai": "^4.2.21",
|
|
@@ -74,5 +75,5 @@
|
|
|
74
75
|
"sinon": "^17.0.1",
|
|
75
76
|
"typescript": "^5.0.4"
|
|
76
77
|
},
|
|
77
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "610f66813a9fa7e0b5240896a273be0e90e60d50"
|
|
78
79
|
}
|