@mastra/client-js 0.1.0-alpha.15 → 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 +3 -0
- package/dist/index.mjs +7 -6
- package/package.json +7 -7
- package/src/client.ts +8 -6
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
|
|
419
|
-
scope
|
|
420
|
-
page: String(page)
|
|
421
|
-
perPage
|
|
422
|
-
|
|
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
|
|
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.
|
|
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",
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
},
|
|
17
17
|
"repository": "github:mastra-ai/client-js",
|
|
18
18
|
"license": "ISC",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup-node src/index.ts --format esm --dts --clean --treeshake",
|
|
21
|
+
"dev": "tsup-node src/index.ts --format esm --dts --clean --treeshake --watch",
|
|
22
|
+
"test": "vitest run"
|
|
23
|
+
},
|
|
19
24
|
"dependencies": {
|
|
20
25
|
"@mastra/core": "^0.2.0-alpha.83",
|
|
21
26
|
"json-schema": "^0.4.0",
|
|
@@ -31,10 +36,5 @@
|
|
|
31
36
|
"tsup": "^8.0.1",
|
|
32
37
|
"typescript": "^5.7.3",
|
|
33
38
|
"vitest": "^3.0.4"
|
|
34
|
-
},
|
|
35
|
-
"scripts": {
|
|
36
|
-
"build": "tsup-node src/index.ts --format esm --dts --clean --treeshake",
|
|
37
|
-
"dev": "tsup-node src/index.ts --format esm --dts --clean --treeshake --watch",
|
|
38
|
-
"test": "vitest run"
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
}
|
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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
|
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
|
}
|