1
1
'use strict' ;
2
-
3
- const os = require ( 'os' ) ;
4
2
const ReadPreference = require ( './read_preference' ) ;
5
- const Buffer = require ( 'safe-buffer' ) . Buffer ;
6
3
const TopologyType = require ( '../sdam/common' ) . TopologyType ;
7
4
const MongoError = require ( '../error' ) . MongoError ;
8
5
@@ -18,62 +15,6 @@ function emitSDAMEvent(self, event, description) {
18
15
}
19
16
}
20
17
21
- // Get package.json variable
22
- const driverVersion = require ( '../../../package.json' ) . version ;
23
- const nodejsVersion = `'Node.js ${ process . version } , ${ os . endianness } ` ;
24
- const type = os . type ( ) ;
25
- const name = process . platform ;
26
- const architecture = process . arch ;
27
- const release = os . release ( ) ;
28
-
29
- function createClientInfo ( options ) {
30
- const clientInfo = options . clientInfo
31
- ? clone ( options . clientInfo )
32
- : {
33
- driver : {
34
- name : 'nodejs' ,
35
- version : driverVersion
36
- } ,
37
- os : {
38
- type : type ,
39
- name : name ,
40
- architecture : architecture ,
41
- version : release
42
- }
43
- } ;
44
-
45
- if ( options . useUnifiedTopology ) {
46
- clientInfo . platform = `${ nodejsVersion } (${ options . useUnifiedTopology ? 'unified' : 'legacy' } )` ;
47
- }
48
-
49
- // Do we have an application specific string
50
- if ( options . appname ) {
51
- // Cut at 128 bytes
52
- var buffer = Buffer . from ( options . appname ) ;
53
- // Return the truncated appname
54
- var appname = buffer . length > 128 ? buffer . slice ( 0 , 128 ) . toString ( 'utf8' ) : options . appname ;
55
- // Add to the clientInfo
56
- clientInfo . application = { name : appname } ;
57
- }
58
-
59
- // support optionally provided wrapping driver info
60
- if ( options . driverInfo ) {
61
- if ( options . driverInfo . name ) {
62
- clientInfo . driver . name = `${ clientInfo . driver . name } |${ options . driverInfo . name } ` ;
63
- }
64
-
65
- if ( options . driverInfo . version ) {
66
- clientInfo . driver . version = `${ clientInfo . driver . version } |${ options . driverInfo . version } ` ;
67
- }
68
-
69
- if ( options . driverInfo . platform ) {
70
- clientInfo . platform = `${ clientInfo . platform } |${ options . driverInfo . platform } ` ;
71
- }
72
- }
73
-
74
- return clientInfo ;
75
- }
76
-
77
18
function createCompressionInfo ( options ) {
78
19
if ( ! options . compression || ! options . compression . compressors ) {
79
20
return [ ] ;
@@ -475,7 +416,6 @@ module.exports.getTopologyType = getTopologyType;
475
416
module . exports . emitServerDescriptionChanged = emitServerDescriptionChanged ;
476
417
module . exports . emitTopologyDescriptionChanged = emitTopologyDescriptionChanged ;
477
418
module . exports . cloneOptions = cloneOptions ;
478
- module . exports . createClientInfo = createClientInfo ;
479
419
module . exports . createCompressionInfo = createCompressionInfo ;
480
420
module . exports . clone = clone ;
481
421
module . exports . diff = diff ;
0 commit comments