@neuledge/graph 0.3.2 → 0.3.4

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.
Files changed (2) hide show
  1. package/bin/cli.js +37 -40
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -2,44 +2,42 @@
2
2
 
3
3
  const [, , command, ...args] = process.argv;
4
4
 
5
- const NEULEDGE_API_BASE_URL = "https://api.graph.neuledge.com/v1";
5
+ const NEULEDGE_API_BASE_URL = "https://api.graph.neuledge.com/v0";
6
6
 
7
7
  (async () => {
8
- try {
9
- switch (command) {
10
- case "sign-up": {
11
- const email = args[0];
12
- if (!email) {
13
- console.error("Usage: sign-up <email>");
14
- process.exit(1);
15
- }
16
-
17
- console.log("Signing up…");
8
+ switch (command) {
9
+ case "sign-up": {
10
+ const email = args[0];
11
+ if (!email) {
12
+ console.error("Usage: sign-up <email>");
13
+ process.exit(1);
14
+ }
18
15
 
19
- const result = await signUp(email);
16
+ console.log("Signing up…");
20
17
 
21
- console.log("✅ Signed up successfully");
22
- if (result?.message) {
23
- console.log(result.message);
24
- }
18
+ const result = await signUp(email);
25
19
 
26
- break;
20
+ console.log("✅ Signed up successfully");
21
+ if (result?.message) {
22
+ console.log(result.message);
27
23
  }
28
24
 
29
- case undefined:
30
- case "help":
31
- printHelp();
32
- break;
33
-
34
- default:
35
- console.error(`Unknown command: ${command}`);
36
- process.exit(1);
25
+ break;
37
26
  }
38
- } catch (err) {
39
- console.error("❌", err.message);
40
- process.exit(1);
27
+
28
+ case undefined:
29
+ case "help":
30
+ printHelp();
31
+ break;
32
+
33
+ default:
34
+ console.error(`Unknown command: ${command}`);
35
+ process.exit(1);
41
36
  }
42
- })();
37
+ })().catch((err) => {
38
+ console.error("❌", err.message);
39
+ process.exit(1);
40
+ });
43
41
 
44
42
  function printHelp() {
45
43
  console.log(`
@@ -75,17 +73,16 @@ async function signUp(email) {
75
73
  });
76
74
 
77
75
  if (!res.ok) {
78
- const text = await res
79
- .json()
80
- .then((body) => {
81
- const message = body?.error?.message;
82
- if (!message) {
83
- throw new Error("Invalid error format");
84
- }
85
-
86
- return message;
87
- })
88
- .catch(() => res.text());
76
+ let text = await res.text().catch(() => "No additional detail provided");
77
+
78
+ try {
79
+ const body = JSON.parse(text);
80
+ const message = body?.error?.message;
81
+ if (message) {
82
+ text = message;
83
+ }
84
+ } catch (_e) {}
85
+
89
86
  throw new Error(`Sign-up failed (${res.status}): ${text}`);
90
87
  }
91
88
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuledge/graph",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Connect your LLM to live weather, stocks, and currency data without API integration work. Structured data in <100ms.",
5
5
  "keywords": [
6
6
  "llm",