@topolo/sdk 0.9.7 → 0.9.9

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.
@@ -58,23 +58,50 @@ var TopoloSdkError = class extends Error {
58
58
  }
59
59
  };
60
60
  var TopoloAuthError = class extends TopoloSdkError {
61
- constructor(message, code = "auth_error") {
61
+ status;
62
+ body;
63
+ service;
64
+ path;
65
+ requestId;
66
+ retryAfter;
67
+ constructor(message, code = "auth_error", options = {}) {
62
68
  super(code, message);
63
69
  this.name = "TopoloAuthError";
70
+ this.status = options.status ?? 401;
71
+ this.body = options.body;
72
+ this.service = options.service;
73
+ this.path = options.path;
74
+ this.requestId = options.requestId;
75
+ this.retryAfter = options.retryAfter;
64
76
  }
65
77
  };
78
+ function extractHttpErrorCode(body) {
79
+ if (!body || typeof body !== "object" || Array.isArray(body)) return "http_error";
80
+ const record = body;
81
+ if (typeof record.code === "string" && record.code.trim()) return record.code.trim();
82
+ const nested = record.error;
83
+ if (nested && typeof nested === "object" && !Array.isArray(nested)) {
84
+ const code = nested.code;
85
+ if (typeof code === "string" && code.trim()) return code.trim();
86
+ }
87
+ return "http_error";
88
+ }
66
89
  var TopoloHttpError = class extends TopoloSdkError {
67
90
  status;
68
91
  body;
69
92
  service;
70
93
  path;
71
- constructor(service, path, status, body, message) {
72
- super("http_error", message ?? `HTTP ${status} from ${service}${path}`);
94
+ requestId;
95
+ retryAfter;
96
+ constructor(service, path, status, body, message, options = {}) {
97
+ super(extractHttpErrorCode(body), message ?? `HTTP ${status} from ${service}${path}`);
73
98
  this.name = "TopoloHttpError";
74
99
  this.status = status;
75
100
  this.body = body;
76
101
  this.service = service;
77
102
  this.path = path;
103
+ this.requestId = options.requestId;
104
+ this.retryAfter = options.retryAfter;
78
105
  }
79
106
  };
80
107
 
@@ -83,6 +110,7 @@ var APP_API_URLS = {
83
110
  agent: "https://agent.topolo.app",
84
111
  auth: "https://auth.topolo.app",
85
112
  backup: "https://backup.topolo.app",
113
+ blog: "https://blog.topolo.app",
86
114
  books: "https://books.topolo.app",
87
115
  brand: "https://brand.topolo.app",
88
116
  bugfix: "https://bugfix.topolo.app",
@@ -95,6 +123,7 @@ var APP_API_URLS = {
95
123
  compose: "https://compose.topolo.app",
96
124
  consent: "https://consent.topolo.app",
97
125
  crm: "https://crm.topolo.app",
126
+ design: "https://design.topolo.app",
98
127
  developers: "https://developers.topolo.app",
99
128
  director: "https://director.topolo.app",
100
129
  feed: "https://feed.topolo.app",
@@ -14,23 +14,50 @@ var TopoloSdkError = class extends Error {
14
14
  }
15
15
  };
16
16
  var TopoloAuthError = class extends TopoloSdkError {
17
- constructor(message, code = "auth_error") {
17
+ status;
18
+ body;
19
+ service;
20
+ path;
21
+ requestId;
22
+ retryAfter;
23
+ constructor(message, code = "auth_error", options = {}) {
18
24
  super(code, message);
19
25
  this.name = "TopoloAuthError";
26
+ this.status = options.status ?? 401;
27
+ this.body = options.body;
28
+ this.service = options.service;
29
+ this.path = options.path;
30
+ this.requestId = options.requestId;
31
+ this.retryAfter = options.retryAfter;
20
32
  }
21
33
  };
34
+ function extractHttpErrorCode(body) {
35
+ if (!body || typeof body !== "object" || Array.isArray(body)) return "http_error";
36
+ const record = body;
37
+ if (typeof record.code === "string" && record.code.trim()) return record.code.trim();
38
+ const nested = record.error;
39
+ if (nested && typeof nested === "object" && !Array.isArray(nested)) {
40
+ const code = nested.code;
41
+ if (typeof code === "string" && code.trim()) return code.trim();
42
+ }
43
+ return "http_error";
44
+ }
22
45
  var TopoloHttpError = class extends TopoloSdkError {
23
46
  status;
24
47
  body;
25
48
  service;
26
49
  path;
27
- constructor(service, path, status, body, message) {
28
- super("http_error", message ?? `HTTP ${status} from ${service}${path}`);
50
+ requestId;
51
+ retryAfter;
52
+ constructor(service, path, status, body, message, options = {}) {
53
+ super(extractHttpErrorCode(body), message ?? `HTTP ${status} from ${service}${path}`);
29
54
  this.name = "TopoloHttpError";
30
55
  this.status = status;
31
56
  this.body = body;
32
57
  this.service = service;
33
58
  this.path = path;
59
+ this.requestId = options.requestId;
60
+ this.retryAfter = options.retryAfter;
34
61
  }
35
62
  };
36
63
 
@@ -39,6 +66,7 @@ var APP_API_URLS = {
39
66
  agent: "https://agent.topolo.app",
40
67
  auth: "https://auth.topolo.app",
41
68
  backup: "https://backup.topolo.app",
69
+ blog: "https://blog.topolo.app",
42
70
  books: "https://books.topolo.app",
43
71
  brand: "https://brand.topolo.app",
44
72
  bugfix: "https://bugfix.topolo.app",
@@ -51,6 +79,7 @@ var APP_API_URLS = {
51
79
  compose: "https://compose.topolo.app",
52
80
  consent: "https://consent.topolo.app",
53
81
  crm: "https://crm.topolo.app",
82
+ design: "https://design.topolo.app",
54
83
  developers: "https://developers.topolo.app",
55
84
  director: "https://director.topolo.app",
56
85
  feed: "https://feed.topolo.app",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@topolo/sdk",
3
- "version": "0.9.7",
4
- "topoloPublishedVersion": "0.9.7",
3
+ "version": "0.9.9",
4
+ "topoloPublishedVersion": "0.9.9",
5
5
  "description": "Typed client SDK for the Topolo platform. Used by TopoloCli, TopoloMCP, and third-party agents.",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",