@mastra/client-js 0.1.0-alpha.16 → 0.1.0-alpha.17

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/README.md CHANGED
@@ -90,6 +90,9 @@ const client = new MastraClient({
90
90
  - `getLogs(params)`: Get system logs
91
91
  - `getLog(params)`: Get specific log entry
92
92
 
93
+ ### Telemetry
94
+ - `getTelemetry(params)`: Get telemetry data
95
+
93
96
  ## Error Handling
94
97
 
95
98
  The client includes built-in retry logic for failed requests:
package/dist/index.mjs CHANGED
@@ -415,13 +415,14 @@ var MastraClient = class extends BaseResource {
415
415
  const { name, scope, page, perPage, attribute } = params || {};
416
416
  const _attribute = attribute ? Object.entries(attribute).map(([key, value]) => `${key}:${value}`) : [];
417
417
  const queryObj = {
418
- name: name ?? "",
419
- scope: scope ?? "",
420
- page: page ? String(page) : "",
421
- perPage: perPage ? String(perPage) : "",
422
- attribute: _attribute?.length ? _attribute : ""
418
+ ...name ? { name } : {},
419
+ ...scope ? { scope } : {},
420
+ ...page ? { page: String(page) } : {},
421
+ ...perPage ? { perPage: String(perPage) } : {},
422
+ ..._attribute?.length ? { attribute: _attribute } : {}
423
423
  };
424
- const queryParams = new URLSearchParams(queryObj);
424
+ const hasQueryParams = Object.keys(queryObj).length > 0;
425
+ const queryParams = hasQueryParams ? new URLSearchParams(queryObj) : "";
425
426
  return this.request(`/api/telemetry?${queryParams}`);
426
427
  }
427
428
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.1.0-alpha.16",
3
+ "version": "0.1.0-alpha.17",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "types": "dist/index.d.mts",
package/src/client.ts CHANGED
@@ -143,14 +143,16 @@ export class MastraClient extends BaseResource {
143
143
  const _attribute = attribute ? Object.entries(attribute).map(([key, value]) => `${key}:${value}`) : [];
144
144
 
145
145
  const queryObj = {
146
- name: name ?? '',
147
- scope: scope ?? '',
148
- page: page ? String(page) : '',
149
- perPage: perPage ? String(perPage) : '',
150
- attribute: _attribute?.length ? _attribute : ''
146
+ ...(name ? { name } : {}),
147
+ ...(scope ? { scope } : {}),
148
+ ...(page ? { page: String(page) } : {}),
149
+ ...(perPage ? { perPage: String(perPage) } : {}),
150
+ ...(_attribute?.length ? { attribute: _attribute } : {})
151
151
  }
152
152
 
153
- const queryParams = new URLSearchParams(queryObj);
153
+ const hasQueryParams = Object.keys(queryObj).length > 0;
154
+
155
+ const queryParams = hasQueryParams ? new URLSearchParams(queryObj) : '';
154
156
  return this.request(`/api/telemetry?${queryParams}`);
155
157
  }
156
158
  }