File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -5,20 +5,16 @@ import logger, { LogId } from "../common/logger.js";
5
5
export const DEVICE_ID_TIMEOUT = 3000 ;
6
6
7
7
/**
8
- * Sets the appName parameter with the extended format: appName--deviceId--clientName
9
- * Only sets the appName if it's not already present in the connection string
8
+ * Retrieves the device ID for telemetry purposes.
9
+ * The device ID is generated using the machine ID and additional logic to handle errors.
10
10
*
11
- * @param connectionString - The connection string to modify
12
- * @param components - The components to build the appName from
13
- * @returns Promise that resolves to the modified connection string
11
+ * @returns Promise that resolves to the device ID string
12
+ * If an error occurs during retrieval, the function returns "unknown".
14
13
*
15
14
* @example
16
15
* ```typescript
17
- * const result = await setExtendedAppNameParam({
18
- * connectionString: "mongodb://localhost:27017",
19
- * components: { appName: "MyApp", clientName: "Cursor" }
20
- * });
21
- * // Result: "mongodb://localhost:27017/?appName=MyApp--deviceId--Cursor"
16
+ * const deviceId = await getDeviceIdForConnection();
17
+ * console.log(deviceId); // Outputs the device ID or "unknown" in case of failure
22
18
* ```
23
19
*/
24
20
export async function getDeviceIdForConnection ( ) : Promise < string > {
You can’t perform that action at this time.
0 commit comments