@oussema_mili/test-pkg-123 1.1.41 → 1.1.42
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/cli-commands.js +1 -17
- package/package.json +1 -1
- package/setup/setupWizard.js +2 -30
package/cli-commands.js
CHANGED
|
@@ -893,27 +893,11 @@ function setupCLICommands(program, startServerFunction) {
|
|
|
893
893
|
{ timeout: 10000 },
|
|
894
894
|
);
|
|
895
895
|
|
|
896
|
-
// Debug: Log the actual response
|
|
897
|
-
console.log(chalk.gray('\n Debug - Backend response:'), JSON.stringify(response.data, null, 2));
|
|
898
|
-
|
|
899
|
-
// Try to get userEntityRef from backend, fallback to session, then "unknown"
|
|
900
|
-
let userEntityRef = response.data.userEntityRef;
|
|
901
|
-
|
|
902
|
-
if (!userEntityRef || userEntityRef === 'unknown') {
|
|
903
|
-
const session = loadSession();
|
|
904
|
-
if (session && isSessionValid(session) && session.userEntityRef) {
|
|
905
|
-
userEntityRef = session.userEntityRef;
|
|
906
|
-
console.log(chalk.gray(' Using userEntityRef from session: ' + userEntityRef));
|
|
907
|
-
} else {
|
|
908
|
-
userEntityRef = "unknown";
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
|
|
912
896
|
// Save credentials
|
|
913
897
|
saveDeviceCredential({
|
|
914
898
|
deviceId: response.data.deviceId,
|
|
915
899
|
deviceCredential: response.data.deviceCredential,
|
|
916
|
-
userEntityRef: userEntityRef,
|
|
900
|
+
userEntityRef: response.data.userEntityRef || "unknown",
|
|
917
901
|
deviceName: deviceMetadata.deviceName,
|
|
918
902
|
platform: deviceMetadata.platform,
|
|
919
903
|
agentVersion: deviceMetadata.agentVersion,
|
package/package.json
CHANGED
package/setup/setupWizard.js
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
displayPrerequisites,
|
|
7
7
|
getMissingPrerequisites,
|
|
8
8
|
} from "../utils/prerequisites.js";
|
|
9
|
-
import { loadSession, isSessionValid } from "../auth.js";
|
|
10
9
|
import {
|
|
11
10
|
promptRegistrationToken,
|
|
12
11
|
promptConfirmation,
|
|
@@ -255,27 +254,11 @@ export class SetupWizard {
|
|
|
255
254
|
{ timeout: 10000 }
|
|
256
255
|
);
|
|
257
256
|
|
|
258
|
-
// Debug: Log the actual response to understand what backend returns
|
|
259
|
-
console.log(chalk.gray(' Debug - Backend response:'), JSON.stringify(response.data, null, 2));
|
|
260
|
-
|
|
261
|
-
// Try to get userEntityRef from backend, fallback to session, then "unknown"
|
|
262
|
-
let userEntityRef = response.data.userEntityRef;
|
|
263
|
-
|
|
264
|
-
if (!userEntityRef || userEntityRef === 'unknown') {
|
|
265
|
-
const session = loadSession();
|
|
266
|
-
if (session && isSessionValid(session) && session.userEntityRef) {
|
|
267
|
-
userEntityRef = session.userEntityRef;
|
|
268
|
-
console.log(chalk.gray(' Using userEntityRef from session: ' + userEntityRef));
|
|
269
|
-
} else {
|
|
270
|
-
userEntityRef = "unknown";
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
257
|
return {
|
|
275
258
|
deviceId: response.data.deviceId,
|
|
276
259
|
deviceCredential: response.data.deviceCredential,
|
|
277
260
|
registryConfig: response.data.registryConfig,
|
|
278
|
-
userEntityRef: userEntityRef,
|
|
261
|
+
userEntityRef: response.data.userEntityRef || "unknown",
|
|
279
262
|
};
|
|
280
263
|
} catch (error) {
|
|
281
264
|
if (error.response?.status === 401) {
|
|
@@ -384,22 +367,11 @@ export class SetupWizard {
|
|
|
384
367
|
console.log("");
|
|
385
368
|
displayHeader("Setup Summary");
|
|
386
369
|
|
|
387
|
-
// Use session userEntityRef if device credential has unknown
|
|
388
|
-
let displayUser = registrationData.userEntityRef;
|
|
389
|
-
if (!displayUser || displayUser === "unknown") {
|
|
390
|
-
const session = loadSession();
|
|
391
|
-
if (session && isSessionValid(session) && session.userEntityRef) {
|
|
392
|
-
displayUser = session.userEntityRef;
|
|
393
|
-
} else {
|
|
394
|
-
displayUser = "N/A";
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
370
|
displayKeyValue({
|
|
399
371
|
"Device ID": registrationData.deviceId,
|
|
400
372
|
"Device Name": registrationData.deviceName || "N/A",
|
|
401
373
|
Platform: registrationData.platform || "N/A",
|
|
402
|
-
User:
|
|
374
|
+
User: registrationData.userEntityRef || "N/A",
|
|
403
375
|
});
|
|
404
376
|
|
|
405
377
|
console.log("");
|