@etainabl/nodejs-sdk 1.2.23 → 1.2.24
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/cjs/db.js +26 -0
- package/dist/mjs/db.js +26 -0
- package/package.json +1 -1
- package/src/db.ts +29 -0
package/dist/cjs/db.js
CHANGED
|
@@ -25,6 +25,32 @@ function showDebugInfo(client) {
|
|
|
25
25
|
const uri = `mongodb+srv://${process.env.ETAINABL_DB_URL}`;
|
|
26
26
|
const sanitizedUri = uri.replace(/\/\/[^@]*@/, '//***:***@'); // Hide credentials
|
|
27
27
|
log.debug(`Connection URI: ${sanitizedUri}`);
|
|
28
|
+
// Get connection info using hello command (works with lower privileges)
|
|
29
|
+
try {
|
|
30
|
+
const helloInfo = yield client.db().command({ hello: 1 });
|
|
31
|
+
log.debug(`Connected to: ${helloInfo.me || helloInfo.primary}`);
|
|
32
|
+
if (helloInfo.hosts) {
|
|
33
|
+
log.debug('Cluster hosts:');
|
|
34
|
+
helloInfo.hosts.forEach((host) => {
|
|
35
|
+
log.debug(`- ${host}`);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// Connection type
|
|
39
|
+
log.debug(`Connection type: ${helloInfo.ismaster ? 'Primary' : 'Secondary'}`);
|
|
40
|
+
log.debug(`Connection set name: ${helloInfo.setName || 'Not part of a replica set'}`);
|
|
41
|
+
// Direct client info
|
|
42
|
+
const connectionInfo = client.options.hosts;
|
|
43
|
+
if (connectionInfo && connectionInfo.length > 0) {
|
|
44
|
+
log.debug('Client connection details:');
|
|
45
|
+
connectionInfo.forEach((host) => {
|
|
46
|
+
log.debug(`- ${host.host}:${host.port}`);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
log.debug('Could not retrieve connection info:', err.message);
|
|
52
|
+
}
|
|
53
|
+
// Remaining original code...
|
|
28
54
|
// Get database admin
|
|
29
55
|
const admin = client.db().admin();
|
|
30
56
|
// Get server information
|
package/dist/mjs/db.js
CHANGED
|
@@ -9,6 +9,32 @@ async function showDebugInfo(client) {
|
|
|
9
9
|
const uri = `mongodb+srv://${process.env.ETAINABL_DB_URL}`;
|
|
10
10
|
const sanitizedUri = uri.replace(/\/\/[^@]*@/, '//***:***@'); // Hide credentials
|
|
11
11
|
log.debug(`Connection URI: ${sanitizedUri}`);
|
|
12
|
+
// Get connection info using hello command (works with lower privileges)
|
|
13
|
+
try {
|
|
14
|
+
const helloInfo = await client.db().command({ hello: 1 });
|
|
15
|
+
log.debug(`Connected to: ${helloInfo.me || helloInfo.primary}`);
|
|
16
|
+
if (helloInfo.hosts) {
|
|
17
|
+
log.debug('Cluster hosts:');
|
|
18
|
+
helloInfo.hosts.forEach((host) => {
|
|
19
|
+
log.debug(`- ${host}`);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
// Connection type
|
|
23
|
+
log.debug(`Connection type: ${helloInfo.ismaster ? 'Primary' : 'Secondary'}`);
|
|
24
|
+
log.debug(`Connection set name: ${helloInfo.setName || 'Not part of a replica set'}`);
|
|
25
|
+
// Direct client info
|
|
26
|
+
const connectionInfo = client.options.hosts;
|
|
27
|
+
if (connectionInfo && connectionInfo.length > 0) {
|
|
28
|
+
log.debug('Client connection details:');
|
|
29
|
+
connectionInfo.forEach((host) => {
|
|
30
|
+
log.debug(`- ${host.host}:${host.port}`);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
log.debug('Could not retrieve connection info:', err.message);
|
|
36
|
+
}
|
|
37
|
+
// Remaining original code...
|
|
12
38
|
// Get database admin
|
|
13
39
|
const admin = client.db().admin();
|
|
14
40
|
// Get server information
|
package/package.json
CHANGED
package/src/db.ts
CHANGED
|
@@ -14,6 +14,35 @@ async function showDebugInfo(client: MongoClient) {
|
|
|
14
14
|
const sanitizedUri = uri.replace(/\/\/[^@]*@/, '//***:***@'); // Hide credentials
|
|
15
15
|
log.debug(`Connection URI: ${sanitizedUri}`);
|
|
16
16
|
|
|
17
|
+
// Get connection info using hello command (works with lower privileges)
|
|
18
|
+
try {
|
|
19
|
+
const helloInfo = await client.db().command({ hello: 1 });
|
|
20
|
+
log.debug(`Connected to: ${helloInfo.me || helloInfo.primary}`);
|
|
21
|
+
|
|
22
|
+
if (helloInfo.hosts) {
|
|
23
|
+
log.debug('Cluster hosts:');
|
|
24
|
+
helloInfo.hosts.forEach((host: string) => {
|
|
25
|
+
log.debug(`- ${host}`);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Connection type
|
|
30
|
+
log.debug(`Connection type: ${helloInfo.ismaster ? 'Primary' : 'Secondary'}`);
|
|
31
|
+
log.debug(`Connection set name: ${helloInfo.setName || 'Not part of a replica set'}`);
|
|
32
|
+
|
|
33
|
+
// Direct client info
|
|
34
|
+
const connectionInfo = client.options.hosts;
|
|
35
|
+
if (connectionInfo && connectionInfo.length > 0) {
|
|
36
|
+
log.debug('Client connection details:');
|
|
37
|
+
connectionInfo.forEach((host: any) => {
|
|
38
|
+
log.debug(`- ${host.host}:${host.port}`);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
} catch (err: any) {
|
|
42
|
+
log.debug('Could not retrieve connection info:', err.message);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Remaining original code...
|
|
17
46
|
// Get database admin
|
|
18
47
|
const admin = client.db().admin();
|
|
19
48
|
|