@ilivemylife/graph-sdk 1.0.5 → 1.0.6

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/cli.mjs CHANGED
@@ -523,7 +523,7 @@ function createApolloClient(options) {
523
523
  const { token, httpUrl, wsUrl, enableSubscriptions, webSocketImpl } = options;
524
524
  const requestHeaders = {
525
525
  "access-token": token,
526
- "x-client": `sdk/${"1.0.5"}`
526
+ "x-client": `sdk/${"1.0.6"}`
527
527
  };
528
528
  const httpLink = createHttpLink({
529
529
  uri: httpUrl,
@@ -536,7 +536,7 @@ function createApolloClient(options) {
536
536
  if (enableSubscriptions) {
537
537
  const wsClientOptions = {
538
538
  url: wsUrl,
539
- connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.5"}` }
539
+ connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.6"}` }
540
540
  };
541
541
  if (webSocketImpl) {
542
542
  wsClientOptions.webSocketImpl = webSocketImpl;
@@ -2383,7 +2383,7 @@ async function cmdUpdate() {
2383
2383
  const { execSync } = await import("child_process");
2384
2384
  console.log("Checking for updates...");
2385
2385
  try {
2386
- const currentVersion = "1.0.5";
2386
+ const currentVersion = "1.0.6";
2387
2387
  let latestVersion;
2388
2388
  try {
2389
2389
  const result = execSync("npm view @ilivemylife/graph-sdk version", { encoding: "utf-8" }).trim();
@@ -2413,13 +2413,33 @@ async function cmdDoctor() {
2413
2413
  console.log("\u2550".repeat(60));
2414
2414
  let issues = 0;
2415
2415
  console.log(`
2416
- [Version] ${"1.0.5"}`);
2416
+ [Version] ${"1.0.6"}`);
2417
2417
  const localConfigPath = findLocalConfigFile();
2418
2418
  const globalExists = existsSync2(GLOBAL_CONFIG_FILE);
2419
2419
  console.log("\n[Config Files]");
2420
2420
  console.log(" Priority: local config > .env > global config > env var\n");
2421
- const { source: activeSource } = resolveTokenWithSource();
2421
+ const { source: activeSource, token } = resolveTokenWithSource();
2422
2422
  const envToken = readEnvToken();
2423
+ let apiUser = null;
2424
+ let apiError = null;
2425
+ if (token) {
2426
+ try {
2427
+ const graph = createGraphClient({ token });
2428
+ apiUser = await graph.me();
2429
+ } catch (error) {
2430
+ const message = error.message;
2431
+ if (message.includes("401") || message.includes("auth") || message.includes("token")) {
2432
+ apiError = 'Token is invalid or expired. Run "ilml login" to re-authenticate';
2433
+ } else if (message.includes("ENOTFOUND") || message.includes("network")) {
2434
+ apiError = "Network error \u2014 cannot reach API";
2435
+ } else {
2436
+ apiError = message;
2437
+ }
2438
+ issues++;
2439
+ }
2440
+ }
2441
+ const activeName = apiUser ? apiUser.displayName || apiUser.fullName || apiUser.email : null;
2442
+ const activeLabel = activeName ? `\u2190 ACTIVE (${activeName})` : "\u2190 ACTIVE";
2423
2443
  if (localConfigPath) {
2424
2444
  console.log(` Local config: ${localConfigPath}`);
2425
2445
  try {
@@ -2429,7 +2449,7 @@ async function cmdDoctor() {
2429
2449
  }
2430
2450
  if (localData.token) {
2431
2451
  console.log(` Token: ${localData.token.substring(0, 10)}...`);
2432
- if (activeSource === "local") console.log(" \u2190 ACTIVE");
2452
+ if (activeSource === "local") console.log(` ${activeLabel}`);
2433
2453
  } else {
2434
2454
  console.log(' Token: (missing \u2014 run "ilml login --local")');
2435
2455
  }
@@ -2450,7 +2470,7 @@ async function cmdDoctor() {
2450
2470
  }
2451
2471
  if (globalData.token) {
2452
2472
  console.log(` Token: ${globalData.token.substring(0, 10)}...`);
2453
- if (activeSource === "global") console.log(" \u2190 ACTIVE");
2473
+ if (activeSource === "global") console.log(` ${activeLabel}`);
2454
2474
  } else {
2455
2475
  console.log(' Token: (missing \u2014 run "ilml login")');
2456
2476
  }
@@ -2467,7 +2487,7 @@ async function cmdDoctor() {
2467
2487
  if (existsSync2(envPath)) {
2468
2488
  if (envToken) {
2469
2489
  console.log(` ILML_TOKEN: ${envToken.substring(0, 10)}...`);
2470
- if (activeSource === "env-file") console.log(" \u2190 ACTIVE");
2490
+ if (activeSource === "env-file") console.log(` ${activeLabel}`);
2471
2491
  } else {
2472
2492
  console.log(" (exists but no ILML_TOKEN found)");
2473
2493
  }
@@ -2477,34 +2497,17 @@ async function cmdDoctor() {
2477
2497
  console.log("");
2478
2498
  console.log(` ILML_TOKEN env: ${process.env.ILML_TOKEN ? `set (${process.env.ILML_TOKEN.substring(0, 10)}...)` : "not set"}`);
2479
2499
  if (activeSource === "env-var") {
2480
- console.log(" \u2190 ACTIVE");
2500
+ console.log(` ${activeLabel}`);
2481
2501
  }
2482
- const hasAnyAuth = localConfigPath || envToken || globalExists || process.env.ILML_TOKEN;
2483
- if (!hasAnyAuth) {
2502
+ if (!token) {
2484
2503
  console.log("\n \u2717 No authentication configured");
2485
2504
  issues++;
2486
- }
2487
- const token = getStoredToken();
2488
- if (token) {
2489
- console.log("\n[API Connection]");
2490
- try {
2491
- const graph = createGraphClient({ token });
2492
- const user = await graph.me();
2493
- console.log(` \u2713 Connected as: ${user.displayName || user.fullName || user.email}`);
2494
- console.log(` \u2713 Root node: ${user.rootItemId}`);
2495
- } catch (error) {
2496
- const message = error.message;
2497
- if (message.includes("401") || message.includes("auth") || message.includes("token")) {
2498
- console.log(" \u2717 Token is invalid or expired");
2499
- console.log(' \u2192 Run "ilml login" to re-authenticate');
2500
- } else if (message.includes("ENOTFOUND") || message.includes("network")) {
2501
- console.log(" \u2717 Network error - cannot reach API");
2502
- console.log(" \u2192 Check your internet connection");
2503
- } else {
2504
- console.log(` \u2717 API error: ${message}`);
2505
- }
2506
- issues++;
2507
- }
2505
+ } else if (apiError) {
2506
+ console.log(`
2507
+ \u2717 ${apiError}`);
2508
+ } else if (apiUser) {
2509
+ console.log(`
2510
+ \u2713 Connected \xB7 Root node: ${apiUser.rootItemId}`);
2508
2511
  }
2509
2512
  console.log("\n[Environment]");
2510
2513
  console.log(` Node.js: ${process.version}`);
@@ -2601,11 +2604,11 @@ async function cmdUninstall() {
2601
2604
  console.log("\u2550".repeat(60));
2602
2605
  }
2603
2606
  function showVersion() {
2604
- console.log(`@ilivemylife/graph-sdk v${"1.0.5"}`);
2607
+ console.log(`@ilivemylife/graph-sdk v${"1.0.6"}`);
2605
2608
  }
2606
2609
  function showHelp() {
2607
2610
  console.log(`
2608
- @ilivemylife/graph-sdk v${"1.0.5"}
2611
+ @ilivemylife/graph-sdk v${"1.0.6"}
2609
2612
  CLI for iLiveMyLife Knowledge Graph
2610
2613
 
2611
2614
  USAGE
package/dist/client.cjs CHANGED
@@ -623,7 +623,7 @@ function createApolloClient(options) {
623
623
  const { token, httpUrl, wsUrl, enableSubscriptions, webSocketImpl } = options;
624
624
  const requestHeaders = {
625
625
  "access-token": token,
626
- "x-client": `sdk/${"1.0.5"}`
626
+ "x-client": `sdk/${"1.0.6"}`
627
627
  };
628
628
  const httpLink = createHttpLink({
629
629
  uri: httpUrl,
@@ -636,7 +636,7 @@ function createApolloClient(options) {
636
636
  if (enableSubscriptions) {
637
637
  const wsClientOptions = {
638
638
  url: wsUrl,
639
- connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.5"}` }
639
+ connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.6"}` }
640
640
  };
641
641
  if (webSocketImpl) {
642
642
  wsClientOptions.webSocketImpl = webSocketImpl;
package/dist/client.mjs CHANGED
@@ -550,7 +550,7 @@ function createApolloClient(options) {
550
550
  const { token, httpUrl, wsUrl, enableSubscriptions, webSocketImpl } = options;
551
551
  const requestHeaders = {
552
552
  "access-token": token,
553
- "x-client": `sdk/${"1.0.5"}`
553
+ "x-client": `sdk/${"1.0.6"}`
554
554
  };
555
555
  const httpLink = createHttpLink({
556
556
  uri: httpUrl,
@@ -563,7 +563,7 @@ function createApolloClient(options) {
563
563
  if (enableSubscriptions) {
564
564
  const wsClientOptions = {
565
565
  url: wsUrl,
566
- connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.5"}` }
566
+ connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.6"}` }
567
567
  };
568
568
  if (webSocketImpl) {
569
569
  wsClientOptions.webSocketImpl = webSocketImpl;
@@ -540,7 +540,7 @@ function createApolloClient(options) {
540
540
  const { token, httpUrl, wsUrl, enableSubscriptions, webSocketImpl } = options;
541
541
  const requestHeaders = {
542
542
  "access-token": token,
543
- "x-client": `sdk/${"1.0.5"}`
543
+ "x-client": `sdk/${"1.0.6"}`
544
544
  };
545
545
  const httpLink = createHttpLink({
546
546
  uri: httpUrl,
@@ -553,7 +553,7 @@ function createApolloClient(options) {
553
553
  if (enableSubscriptions) {
554
554
  const wsClientOptions = {
555
555
  url: wsUrl,
556
- connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.5"}` }
556
+ connectionParams: { "access-token": token, "x-client": `sdk/${"1.0.6"}` }
557
557
  };
558
558
  if (webSocketImpl) {
559
559
  wsClientOptions.webSocketImpl = webSocketImpl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilivemylife/graph-sdk",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "SDK and CLI for iLiveMyLife Knowledge Graph",
5
5
  "license": "UNLICENSED",
6
6
  "engines": {