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";
55export const DEVICE_ID_TIMEOUT = 3000 ;
66
77/**
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.
1010 *
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".
1413 *
1514 * @example
1615 * ```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
2218 * ```
2319 */
2420export async function getDeviceIdForConnection ( ) : Promise < string > {
You can’t perform that action at this time.
0 commit comments