@mongosh/service-provider-core 3.6.1 → 3.6.3
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/AUTHORS +1 -0
- package/lib/connect-info.d.ts +2 -1
- package/lib/connect-info.js +48 -19
- package/lib/connect-info.js.map +1 -1
- package/package.json +4 -4
- package/src/connect-info.spec.ts +12 -7
- package/src/connect-info.ts +10 -11
package/AUTHORS
CHANGED
package/lib/connect-info.d.ts
CHANGED
|
@@ -21,10 +21,11 @@ export type HostInformation = {
|
|
|
21
21
|
is_atlas_url?: boolean;
|
|
22
22
|
is_do_url?: boolean;
|
|
23
23
|
};
|
|
24
|
-
export default function getConnectExtraInfo({ connectionString, buildInfo, atlasVersion, resolvedHostname, isLocalAtlas, }: {
|
|
24
|
+
export default function getConnectExtraInfo({ connectionString, buildInfo, atlasVersion, resolvedHostname, isLocalAtlas, serverName, }: {
|
|
25
25
|
connectionString?: ConnectionString;
|
|
26
26
|
buildInfo: any;
|
|
27
27
|
atlasVersion: any;
|
|
28
28
|
resolvedHostname?: string;
|
|
29
29
|
isLocalAtlas: boolean;
|
|
30
|
+
serverName?: string;
|
|
30
31
|
}): ConnectionExtraInfo;
|
package/lib/connect-info.js
CHANGED
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
36
|
exports.default = getConnectExtraInfo;
|
|
7
|
-
const
|
|
37
|
+
const getBuildInfo = __importStar(require("mongodb-build-info"));
|
|
8
38
|
function getHostInformation(host) {
|
|
9
39
|
if (!host) {
|
|
10
40
|
return {
|
|
@@ -13,14 +43,14 @@ function getHostInformation(host) {
|
|
|
13
43
|
is_atlas_url: false,
|
|
14
44
|
};
|
|
15
45
|
}
|
|
16
|
-
if (
|
|
46
|
+
if (getBuildInfo.isLocalhost(host)) {
|
|
17
47
|
return {
|
|
18
48
|
is_localhost: true,
|
|
19
49
|
is_do_url: false,
|
|
20
50
|
is_atlas_url: false,
|
|
21
51
|
};
|
|
22
52
|
}
|
|
23
|
-
if (
|
|
53
|
+
if (getBuildInfo.isDigitalOcean(host)) {
|
|
24
54
|
return {
|
|
25
55
|
is_localhost: false,
|
|
26
56
|
is_do_url: true,
|
|
@@ -30,34 +60,33 @@ function getHostInformation(host) {
|
|
|
30
60
|
return {
|
|
31
61
|
is_localhost: false,
|
|
32
62
|
is_do_url: false,
|
|
33
|
-
is_atlas_url:
|
|
63
|
+
is_atlas_url: getBuildInfo.isAtlas(host),
|
|
34
64
|
};
|
|
35
65
|
}
|
|
36
|
-
function getConnectExtraInfo({ connectionString, buildInfo, atlasVersion, resolvedHostname, isLocalAtlas, }) {
|
|
66
|
+
function getConnectExtraInfo({ connectionString, buildInfo, atlasVersion, resolvedHostname, isLocalAtlas, serverName = 'unknown', }) {
|
|
37
67
|
var _a, _b, _c;
|
|
38
68
|
const auth_type = (_a = connectionString === null || connectionString === void 0 ? void 0 : connectionString.searchParams.get('authMechanism')) !== null && _a !== void 0 ? _a : undefined;
|
|
39
69
|
const uri = (_b = connectionString === null || connectionString === void 0 ? void 0 : connectionString.toString()) !== null && _b !== void 0 ? _b : '';
|
|
40
70
|
buildInfo !== null && buildInfo !== void 0 ? buildInfo : (buildInfo = {});
|
|
41
|
-
const {
|
|
42
|
-
const {
|
|
43
|
-
const
|
|
44
|
-
const isAtlas = !!(atlasVersion === null || atlasVersion === void 0 ? void 0 : atlasVersion.atlasVersion) || mongodb_build_info_1.default.isAtlas(uri);
|
|
71
|
+
const { isDataLake: is_data_federation, dlVersion } = getBuildInfo.getDataLake(buildInfo);
|
|
72
|
+
const { serverOs, serverArch } = getBuildInfo.getBuildEnv(buildInfo);
|
|
73
|
+
const isAtlas = !!(atlasVersion === null || atlasVersion === void 0 ? void 0 : atlasVersion.atlasVersion) || getBuildInfo.isAtlas(uri);
|
|
45
74
|
return {
|
|
46
75
|
...getHostInformation(resolvedHostname || uri),
|
|
47
76
|
is_atlas: isAtlas,
|
|
48
77
|
server_version: buildInfo.version,
|
|
49
78
|
node_version: process.version,
|
|
50
|
-
server_os,
|
|
79
|
+
server_os: serverOs || undefined,
|
|
51
80
|
uri,
|
|
52
|
-
server_arch,
|
|
53
|
-
is_enterprise:
|
|
81
|
+
server_arch: serverArch || undefined,
|
|
82
|
+
is_enterprise: getBuildInfo.isEnterprise(buildInfo),
|
|
54
83
|
auth_type,
|
|
55
84
|
is_data_federation,
|
|
56
|
-
is_stream:
|
|
57
|
-
dl_version,
|
|
85
|
+
is_stream: getBuildInfo.isAtlasStream(uri),
|
|
86
|
+
dl_version: dlVersion || undefined,
|
|
58
87
|
atlas_version: (_c = atlasVersion === null || atlasVersion === void 0 ? void 0 : atlasVersion.atlasVersion) !== null && _c !== void 0 ? _c : null,
|
|
59
|
-
is_genuine,
|
|
60
|
-
non_genuine_server_name,
|
|
88
|
+
is_genuine: serverName === 'mongodb' || serverName === 'unknown',
|
|
89
|
+
non_genuine_server_name: serverName,
|
|
61
90
|
is_local_atlas: isLocalAtlas,
|
|
62
91
|
};
|
|
63
92
|
}
|
package/lib/connect-info.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-info.js","sourceRoot":"","sources":["../src/connect-info.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connect-info.js","sourceRoot":"","sources":["../src/connect-info.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,sCA6CC;AAxGD,iEAAmD;AA2BnD,SAAS,kBAAkB,CAAC,IAAa;IACvC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO;YACL,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,KAAK;YAChB,YAAY,EAAE,KAAK;SACpB,CAAC;IACJ,CAAC;IAED,IAAI,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,OAAO;YACL,YAAY,EAAE,IAAI;YAClB,SAAS,EAAE,KAAK;YAChB,YAAY,EAAE,KAAK;SACpB,CAAC;IACJ,CAAC;IAED,IAAI,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,OAAO;YAC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AU,IAAI,SAAS;QACpC,aAAa,EAAE,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC;QACnD,SAAS;QACT,kBAAkB;QAClB,SAAS,EAAE,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC;QAC1C,UAAU,EAAE,SAAS,IAAI,SAAS;QAClC,aAAa,EAAE,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,YAAY,mCAAI,IAAI;QACjD,UAAU,EAAE,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,SAAS;QAChE,uBAAuB,EAAE,UAAU;QACnC,cAAc,EAAE,YAAY;KAC7B,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongosh/service-provider-core",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.3",
|
|
4
4
|
"description": "MongoDB Shell Core Service Provider Package",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@mongosh/errors": "2.4.4",
|
|
40
|
-
"@mongosh/shell-bson": "1.0.
|
|
40
|
+
"@mongosh/shell-bson": "1.0.4",
|
|
41
41
|
"bson": "^6.10.4",
|
|
42
42
|
"mongodb": "^6.19.0",
|
|
43
|
-
"mongodb-build-info": "^1.
|
|
43
|
+
"mongodb-build-info": "^1.8.1",
|
|
44
44
|
"mongodb-connection-string-url": "^3.0.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"eslint": "^7.25.0",
|
|
52
52
|
"prettier": "^2.8.8"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "8e8f9d1a0486078c4ca75fc7a81535eba535f535"
|
|
55
55
|
}
|
package/src/connect-info.spec.ts
CHANGED
|
@@ -64,7 +64,7 @@ describe('getConnectInfo', function () {
|
|
|
64
64
|
auth_type: 'PLAIN',
|
|
65
65
|
is_data_federation: false,
|
|
66
66
|
is_stream: false,
|
|
67
|
-
dl_version:
|
|
67
|
+
dl_version: undefined,
|
|
68
68
|
atlas_version: '20210330.0.0.1617063608',
|
|
69
69
|
is_genuine: true,
|
|
70
70
|
non_genuine_server_name: 'mongodb',
|
|
@@ -81,6 +81,7 @@ describe('getConnectInfo', function () {
|
|
|
81
81
|
atlasVersion: ATLAS_VERSION,
|
|
82
82
|
resolvedHostname: 'test-data-sets-00-02-a011bb.mongodb.net',
|
|
83
83
|
isLocalAtlas: false,
|
|
84
|
+
serverName: 'mongodb',
|
|
84
85
|
})
|
|
85
86
|
).to.deep.equal(output);
|
|
86
87
|
});
|
|
@@ -96,7 +97,7 @@ describe('getConnectInfo', function () {
|
|
|
96
97
|
auth_type: undefined,
|
|
97
98
|
is_data_federation: false,
|
|
98
99
|
is_stream: false,
|
|
99
|
-
dl_version:
|
|
100
|
+
dl_version: undefined,
|
|
100
101
|
atlas_version: '20210330.0.0.1617063608',
|
|
101
102
|
is_genuine: true,
|
|
102
103
|
non_genuine_server_name: 'mongodb',
|
|
@@ -113,6 +114,7 @@ describe('getConnectInfo', function () {
|
|
|
113
114
|
atlasVersion: ATLAS_VERSION,
|
|
114
115
|
resolvedHostname: 'test-data-sets-00-02-a011bb.mongodb.net',
|
|
115
116
|
isLocalAtlas: false,
|
|
117
|
+
serverName: 'mongodb',
|
|
116
118
|
})
|
|
117
119
|
).to.deep.equal(output);
|
|
118
120
|
});
|
|
@@ -130,7 +132,7 @@ describe('getConnectInfo', function () {
|
|
|
130
132
|
auth_type: undefined,
|
|
131
133
|
is_data_federation: false,
|
|
132
134
|
is_stream: true,
|
|
133
|
-
dl_version:
|
|
135
|
+
dl_version: undefined,
|
|
134
136
|
atlas_version: null,
|
|
135
137
|
is_genuine: true,
|
|
136
138
|
is_local_atlas: false,
|
|
@@ -148,6 +150,7 @@ describe('getConnectInfo', function () {
|
|
|
148
150
|
resolvedHostname:
|
|
149
151
|
'atlas-stream-67b8e1cd6d60357be377be7b-1dekw.virginia-usa.a.query.mongodb-dev.net',
|
|
150
152
|
isLocalAtlas: false,
|
|
153
|
+
serverName: 'mongodb',
|
|
151
154
|
})
|
|
152
155
|
).to.deep.equal(output);
|
|
153
156
|
});
|
|
@@ -163,7 +166,7 @@ describe('getConnectInfo', function () {
|
|
|
163
166
|
auth_type: undefined,
|
|
164
167
|
is_data_federation: false,
|
|
165
168
|
is_stream: false,
|
|
166
|
-
dl_version:
|
|
169
|
+
dl_version: undefined,
|
|
167
170
|
atlas_version: null,
|
|
168
171
|
is_genuine: true,
|
|
169
172
|
non_genuine_server_name: 'mongodb',
|
|
@@ -179,6 +182,7 @@ describe('getConnectInfo', function () {
|
|
|
179
182
|
atlasVersion: null,
|
|
180
183
|
resolvedHostname: 'localhost',
|
|
181
184
|
isLocalAtlas: true,
|
|
185
|
+
serverName: 'mongodb',
|
|
182
186
|
})
|
|
183
187
|
).to.deep.equal(output);
|
|
184
188
|
});
|
|
@@ -194,13 +198,13 @@ describe('getConnectInfo', function () {
|
|
|
194
198
|
auth_type: undefined,
|
|
195
199
|
is_data_federation: false,
|
|
196
200
|
is_stream: false,
|
|
197
|
-
dl_version:
|
|
201
|
+
dl_version: undefined,
|
|
198
202
|
atlas_version: null,
|
|
199
203
|
is_genuine: true,
|
|
200
204
|
non_genuine_server_name: 'mongodb',
|
|
201
|
-
server_arch: null,
|
|
202
205
|
node_version: process.version,
|
|
203
|
-
server_os:
|
|
206
|
+
server_os: undefined,
|
|
207
|
+
server_arch: undefined,
|
|
204
208
|
uri: '',
|
|
205
209
|
is_local_atlas: false,
|
|
206
210
|
};
|
|
@@ -209,6 +213,7 @@ describe('getConnectInfo', function () {
|
|
|
209
213
|
buildInfo: null,
|
|
210
214
|
atlasVersion: null,
|
|
211
215
|
isLocalAtlas: false,
|
|
216
|
+
serverName: 'mongodb',
|
|
212
217
|
})
|
|
213
218
|
).to.deep.equal(output);
|
|
214
219
|
});
|
package/src/connect-info.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// ^ segment data is in snake_case: forgive me javascript, for i have sinned.
|
|
2
2
|
|
|
3
|
-
import getBuildInfo from 'mongodb-build-info';
|
|
3
|
+
import * as getBuildInfo from 'mongodb-build-info';
|
|
4
4
|
import type { ConnectionString } from 'mongodb-connection-string-url';
|
|
5
5
|
|
|
6
6
|
export type ConnectionExtraInfo = {
|
|
@@ -65,26 +65,25 @@ export default function getConnectExtraInfo({
|
|
|
65
65
|
atlasVersion,
|
|
66
66
|
resolvedHostname,
|
|
67
67
|
isLocalAtlas,
|
|
68
|
+
serverName = 'unknown',
|
|
68
69
|
}: {
|
|
69
70
|
connectionString?: ConnectionString;
|
|
70
71
|
buildInfo: any;
|
|
71
72
|
atlasVersion: any;
|
|
72
73
|
resolvedHostname?: string;
|
|
73
74
|
isLocalAtlas: boolean;
|
|
75
|
+
serverName?: string;
|
|
74
76
|
}): ConnectionExtraInfo {
|
|
75
77
|
const auth_type =
|
|
76
78
|
connectionString?.searchParams.get('authMechanism') ?? undefined;
|
|
77
79
|
const uri = connectionString?.toString() ?? '';
|
|
78
80
|
|
|
79
81
|
buildInfo ??= {}; // We're currently not getting buildInfo with --apiStrict.
|
|
80
|
-
const { isGenuine: is_genuine, serverName: non_genuine_server_name } =
|
|
81
|
-
getBuildInfo.getGenuineMongoDB(uri);
|
|
82
82
|
// Atlas Data Lake has been renamed to Atlas Data Federation
|
|
83
|
-
const { isDataLake: is_data_federation, dlVersion
|
|
83
|
+
const { isDataLake: is_data_federation, dlVersion } =
|
|
84
84
|
getBuildInfo.getDataLake(buildInfo);
|
|
85
85
|
|
|
86
|
-
const { serverOs
|
|
87
|
-
getBuildInfo.getBuildEnv(buildInfo);
|
|
86
|
+
const { serverOs, serverArch } = getBuildInfo.getBuildEnv(buildInfo);
|
|
88
87
|
const isAtlas = !!atlasVersion?.atlasVersion || getBuildInfo.isAtlas(uri);
|
|
89
88
|
|
|
90
89
|
return {
|
|
@@ -92,17 +91,17 @@ export default function getConnectExtraInfo({
|
|
|
92
91
|
is_atlas: isAtlas,
|
|
93
92
|
server_version: buildInfo.version,
|
|
94
93
|
node_version: process.version,
|
|
95
|
-
server_os,
|
|
94
|
+
server_os: serverOs || undefined,
|
|
96
95
|
uri,
|
|
97
|
-
server_arch,
|
|
96
|
+
server_arch: serverArch || undefined,
|
|
98
97
|
is_enterprise: getBuildInfo.isEnterprise(buildInfo),
|
|
99
98
|
auth_type,
|
|
100
99
|
is_data_federation,
|
|
101
100
|
is_stream: getBuildInfo.isAtlasStream(uri),
|
|
102
|
-
dl_version,
|
|
101
|
+
dl_version: dlVersion || undefined,
|
|
103
102
|
atlas_version: atlasVersion?.atlasVersion ?? null,
|
|
104
|
-
is_genuine,
|
|
105
|
-
non_genuine_server_name,
|
|
103
|
+
is_genuine: serverName === 'mongodb' || serverName === 'unknown',
|
|
104
|
+
non_genuine_server_name: serverName,
|
|
106
105
|
is_local_atlas: isLocalAtlas,
|
|
107
106
|
};
|
|
108
107
|
}
|