@mastra/client-js 0.1.20-alpha.1 → 0.1.20-alpha.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.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +26 -0
- package/dist/index.cjs +53 -5
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +53 -5
- package/package.json +2 -2
- package/src/client.ts +7 -1
- package/src/resources/vnext-workflow.ts +25 -2
- package/src/resources/workflow.ts +31 -3
- package/src/types.ts +10 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/client-js@0.1.20-alpha.
|
|
2
|
+
> @mastra/client-js@0.1.20-alpha.4 build /home/runner/work/mastra/mastra/client-sdks/client-js
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
[34mCLI[39m Cleaning output folder
|
|
10
10
|
[34mESM[39m Build start
|
|
11
11
|
[34mCJS[39m Build start
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
12
|
+
[32mESM[39m [1mdist/index.js [22m[32m29.18 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 1376ms
|
|
14
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m29.36 KB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 1385ms
|
|
16
16
|
[34mDTS[39m Build start
|
|
17
|
-
[32mDTS[39m ⚡️ Build success in
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m24.
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[32m24.
|
|
17
|
+
[32mDTS[39m ⚡️ Build success in 13669ms
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m24.97 KB[39m
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m24.97 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 0.1.20-alpha.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [ccef9f9]
|
|
8
|
+
- Updated dependencies [51e6923]
|
|
9
|
+
- @mastra/core@0.9.2-alpha.4
|
|
10
|
+
|
|
11
|
+
## 0.1.20-alpha.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 4155f47: Add parameters to filter workflow runs
|
|
16
|
+
Add fromDate and toDate to telemetry parameters
|
|
17
|
+
- Updated dependencies [967b41c]
|
|
18
|
+
- Updated dependencies [4155f47]
|
|
19
|
+
- Updated dependencies [17826a9]
|
|
20
|
+
- @mastra/core@0.9.2-alpha.3
|
|
21
|
+
|
|
22
|
+
## 0.1.20-alpha.2
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [26738f4]
|
|
27
|
+
- @mastra/core@0.9.2-alpha.2
|
|
28
|
+
|
|
3
29
|
## 0.1.20-alpha.1
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -375,10 +375,31 @@ var Workflow = class extends BaseResource {
|
|
|
375
375
|
}
|
|
376
376
|
/**
|
|
377
377
|
* Retrieves all runs for a workflow
|
|
378
|
+
* @param params - Parameters for filtering runs
|
|
378
379
|
* @returns Promise containing workflow runs array
|
|
379
380
|
*/
|
|
380
|
-
runs() {
|
|
381
|
-
|
|
381
|
+
runs(params) {
|
|
382
|
+
const searchParams = new URLSearchParams();
|
|
383
|
+
if (params?.fromDate) {
|
|
384
|
+
searchParams.set("fromDate", params.fromDate.toISOString());
|
|
385
|
+
}
|
|
386
|
+
if (params?.toDate) {
|
|
387
|
+
searchParams.set("toDate", params.toDate.toISOString());
|
|
388
|
+
}
|
|
389
|
+
if (params?.limit) {
|
|
390
|
+
searchParams.set("limit", String(params.limit));
|
|
391
|
+
}
|
|
392
|
+
if (params?.offset) {
|
|
393
|
+
searchParams.set("offset", String(params.offset));
|
|
394
|
+
}
|
|
395
|
+
if (params?.resourceId) {
|
|
396
|
+
searchParams.set("resourceId", params.resourceId);
|
|
397
|
+
}
|
|
398
|
+
if (searchParams.size) {
|
|
399
|
+
return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
|
|
400
|
+
} else {
|
|
401
|
+
return this.request(`/api/workflows/${this.workflowId}/runs`);
|
|
402
|
+
}
|
|
382
403
|
}
|
|
383
404
|
/**
|
|
384
405
|
* @deprecated Use `startAsync` instead
|
|
@@ -622,10 +643,31 @@ var VNextWorkflow = class extends BaseResource {
|
|
|
622
643
|
}
|
|
623
644
|
/**
|
|
624
645
|
* Retrieves all runs for a vNext workflow
|
|
646
|
+
* @param params - Parameters for filtering runs
|
|
625
647
|
* @returns Promise containing vNext workflow runs array
|
|
626
648
|
*/
|
|
627
|
-
runs() {
|
|
628
|
-
|
|
649
|
+
runs(params) {
|
|
650
|
+
const searchParams = new URLSearchParams();
|
|
651
|
+
if (params?.fromDate) {
|
|
652
|
+
searchParams.set("fromDate", params.fromDate.toISOString());
|
|
653
|
+
}
|
|
654
|
+
if (params?.toDate) {
|
|
655
|
+
searchParams.set("toDate", params.toDate.toISOString());
|
|
656
|
+
}
|
|
657
|
+
if (params?.limit) {
|
|
658
|
+
searchParams.set("limit", String(params.limit));
|
|
659
|
+
}
|
|
660
|
+
if (params?.offset) {
|
|
661
|
+
searchParams.set("offset", String(params.offset));
|
|
662
|
+
}
|
|
663
|
+
if (params?.resourceId) {
|
|
664
|
+
searchParams.set("resourceId", params.resourceId);
|
|
665
|
+
}
|
|
666
|
+
if (searchParams.size) {
|
|
667
|
+
return this.request(`/api/workflows/v-next/${this.workflowId}/runs?${searchParams}`);
|
|
668
|
+
} else {
|
|
669
|
+
return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
|
|
670
|
+
}
|
|
629
671
|
}
|
|
630
672
|
/**
|
|
631
673
|
* Creates a new vNext workflow run
|
|
@@ -868,7 +910,7 @@ var MastraClient = class extends BaseResource {
|
|
|
868
910
|
* @returns Promise containing telemetry data
|
|
869
911
|
*/
|
|
870
912
|
getTelemetry(params) {
|
|
871
|
-
const { name, scope, page, perPage, attribute } = params || {};
|
|
913
|
+
const { name, scope, page, perPage, attribute, fromDate, toDate } = params || {};
|
|
872
914
|
const _attribute = attribute ? Object.entries(attribute).map(([key, value]) => `${key}:${value}`) : [];
|
|
873
915
|
const searchParams = new URLSearchParams();
|
|
874
916
|
if (name) {
|
|
@@ -892,6 +934,12 @@ var MastraClient = class extends BaseResource {
|
|
|
892
934
|
searchParams.set("attribute", _attribute);
|
|
893
935
|
}
|
|
894
936
|
}
|
|
937
|
+
if (fromDate) {
|
|
938
|
+
searchParams.set("fromDate", fromDate.toISOString());
|
|
939
|
+
}
|
|
940
|
+
if (toDate) {
|
|
941
|
+
searchParams.set("toDate", toDate.toISOString());
|
|
942
|
+
}
|
|
895
943
|
if (searchParams.size) {
|
|
896
944
|
return this.request(`/api/telemetry?${searchParams}`);
|
|
897
945
|
} else {
|
package/dist/index.d.cts
CHANGED
|
@@ -58,6 +58,13 @@ interface GetWorkflowResponse {
|
|
|
58
58
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
59
59
|
workflowId?: string;
|
|
60
60
|
}
|
|
61
|
+
interface GetWorkflowRunsParams {
|
|
62
|
+
fromDate?: Date;
|
|
63
|
+
toDate?: Date;
|
|
64
|
+
limit?: number;
|
|
65
|
+
offset?: number;
|
|
66
|
+
resourceId?: string;
|
|
67
|
+
}
|
|
61
68
|
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
62
69
|
type WorkflowRunResult = {
|
|
63
70
|
activePaths: Record<string, {
|
|
@@ -197,6 +204,8 @@ interface GetTelemetryParams {
|
|
|
197
204
|
page?: number;
|
|
198
205
|
perPage?: number;
|
|
199
206
|
attribute?: Record<string, string>;
|
|
207
|
+
fromDate?: Date;
|
|
208
|
+
toDate?: Date;
|
|
200
209
|
}
|
|
201
210
|
interface GetNetworkResponse {
|
|
202
211
|
name: string;
|
|
@@ -404,9 +413,10 @@ declare class Workflow extends BaseResource {
|
|
|
404
413
|
details(): Promise<GetWorkflowResponse>;
|
|
405
414
|
/**
|
|
406
415
|
* Retrieves all runs for a workflow
|
|
416
|
+
* @param params - Parameters for filtering runs
|
|
407
417
|
* @returns Promise containing workflow runs array
|
|
408
418
|
*/
|
|
409
|
-
runs(): Promise<GetWorkflowRunsResponse>;
|
|
419
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
410
420
|
/**
|
|
411
421
|
* @deprecated Use `startAsync` instead
|
|
412
422
|
* Executes the workflow with the provided parameters
|
|
@@ -522,9 +532,10 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
522
532
|
details(): Promise<GetVNextWorkflowResponse>;
|
|
523
533
|
/**
|
|
524
534
|
* Retrieves all runs for a vNext workflow
|
|
535
|
+
* @param params - Parameters for filtering runs
|
|
525
536
|
* @returns Promise containing vNext workflow runs array
|
|
526
537
|
*/
|
|
527
|
-
runs(): Promise<GetWorkflowRunsResponse>;
|
|
538
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
528
539
|
/**
|
|
529
540
|
* Creates a new vNext workflow run
|
|
530
541
|
* @param params - Optional object containing the optional runId
|
|
@@ -712,4 +723,4 @@ declare class MastraClient extends BaseResource {
|
|
|
712
723
|
getNetwork(networkId: string): Network;
|
|
713
724
|
}
|
|
714
725
|
|
|
715
|
-
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|
|
726
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,13 @@ interface GetWorkflowResponse {
|
|
|
58
58
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
59
59
|
workflowId?: string;
|
|
60
60
|
}
|
|
61
|
+
interface GetWorkflowRunsParams {
|
|
62
|
+
fromDate?: Date;
|
|
63
|
+
toDate?: Date;
|
|
64
|
+
limit?: number;
|
|
65
|
+
offset?: number;
|
|
66
|
+
resourceId?: string;
|
|
67
|
+
}
|
|
61
68
|
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
62
69
|
type WorkflowRunResult = {
|
|
63
70
|
activePaths: Record<string, {
|
|
@@ -197,6 +204,8 @@ interface GetTelemetryParams {
|
|
|
197
204
|
page?: number;
|
|
198
205
|
perPage?: number;
|
|
199
206
|
attribute?: Record<string, string>;
|
|
207
|
+
fromDate?: Date;
|
|
208
|
+
toDate?: Date;
|
|
200
209
|
}
|
|
201
210
|
interface GetNetworkResponse {
|
|
202
211
|
name: string;
|
|
@@ -404,9 +413,10 @@ declare class Workflow extends BaseResource {
|
|
|
404
413
|
details(): Promise<GetWorkflowResponse>;
|
|
405
414
|
/**
|
|
406
415
|
* Retrieves all runs for a workflow
|
|
416
|
+
* @param params - Parameters for filtering runs
|
|
407
417
|
* @returns Promise containing workflow runs array
|
|
408
418
|
*/
|
|
409
|
-
runs(): Promise<GetWorkflowRunsResponse>;
|
|
419
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
410
420
|
/**
|
|
411
421
|
* @deprecated Use `startAsync` instead
|
|
412
422
|
* Executes the workflow with the provided parameters
|
|
@@ -522,9 +532,10 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
522
532
|
details(): Promise<GetVNextWorkflowResponse>;
|
|
523
533
|
/**
|
|
524
534
|
* Retrieves all runs for a vNext workflow
|
|
535
|
+
* @param params - Parameters for filtering runs
|
|
525
536
|
* @returns Promise containing vNext workflow runs array
|
|
526
537
|
*/
|
|
527
|
-
runs(): Promise<GetWorkflowRunsResponse>;
|
|
538
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
528
539
|
/**
|
|
529
540
|
* Creates a new vNext workflow run
|
|
530
541
|
* @param params - Optional object containing the optional runId
|
|
@@ -712,4 +723,4 @@ declare class MastraClient extends BaseResource {
|
|
|
712
723
|
getNetwork(networkId: string): Network;
|
|
713
724
|
}
|
|
714
725
|
|
|
715
|
-
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|
|
726
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|
package/dist/index.js
CHANGED
|
@@ -373,10 +373,31 @@ var Workflow = class extends BaseResource {
|
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
375
375
|
* Retrieves all runs for a workflow
|
|
376
|
+
* @param params - Parameters for filtering runs
|
|
376
377
|
* @returns Promise containing workflow runs array
|
|
377
378
|
*/
|
|
378
|
-
runs() {
|
|
379
|
-
|
|
379
|
+
runs(params) {
|
|
380
|
+
const searchParams = new URLSearchParams();
|
|
381
|
+
if (params?.fromDate) {
|
|
382
|
+
searchParams.set("fromDate", params.fromDate.toISOString());
|
|
383
|
+
}
|
|
384
|
+
if (params?.toDate) {
|
|
385
|
+
searchParams.set("toDate", params.toDate.toISOString());
|
|
386
|
+
}
|
|
387
|
+
if (params?.limit) {
|
|
388
|
+
searchParams.set("limit", String(params.limit));
|
|
389
|
+
}
|
|
390
|
+
if (params?.offset) {
|
|
391
|
+
searchParams.set("offset", String(params.offset));
|
|
392
|
+
}
|
|
393
|
+
if (params?.resourceId) {
|
|
394
|
+
searchParams.set("resourceId", params.resourceId);
|
|
395
|
+
}
|
|
396
|
+
if (searchParams.size) {
|
|
397
|
+
return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
|
|
398
|
+
} else {
|
|
399
|
+
return this.request(`/api/workflows/${this.workflowId}/runs`);
|
|
400
|
+
}
|
|
380
401
|
}
|
|
381
402
|
/**
|
|
382
403
|
* @deprecated Use `startAsync` instead
|
|
@@ -620,10 +641,31 @@ var VNextWorkflow = class extends BaseResource {
|
|
|
620
641
|
}
|
|
621
642
|
/**
|
|
622
643
|
* Retrieves all runs for a vNext workflow
|
|
644
|
+
* @param params - Parameters for filtering runs
|
|
623
645
|
* @returns Promise containing vNext workflow runs array
|
|
624
646
|
*/
|
|
625
|
-
runs() {
|
|
626
|
-
|
|
647
|
+
runs(params) {
|
|
648
|
+
const searchParams = new URLSearchParams();
|
|
649
|
+
if (params?.fromDate) {
|
|
650
|
+
searchParams.set("fromDate", params.fromDate.toISOString());
|
|
651
|
+
}
|
|
652
|
+
if (params?.toDate) {
|
|
653
|
+
searchParams.set("toDate", params.toDate.toISOString());
|
|
654
|
+
}
|
|
655
|
+
if (params?.limit) {
|
|
656
|
+
searchParams.set("limit", String(params.limit));
|
|
657
|
+
}
|
|
658
|
+
if (params?.offset) {
|
|
659
|
+
searchParams.set("offset", String(params.offset));
|
|
660
|
+
}
|
|
661
|
+
if (params?.resourceId) {
|
|
662
|
+
searchParams.set("resourceId", params.resourceId);
|
|
663
|
+
}
|
|
664
|
+
if (searchParams.size) {
|
|
665
|
+
return this.request(`/api/workflows/v-next/${this.workflowId}/runs?${searchParams}`);
|
|
666
|
+
} else {
|
|
667
|
+
return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
|
|
668
|
+
}
|
|
627
669
|
}
|
|
628
670
|
/**
|
|
629
671
|
* Creates a new vNext workflow run
|
|
@@ -866,7 +908,7 @@ var MastraClient = class extends BaseResource {
|
|
|
866
908
|
* @returns Promise containing telemetry data
|
|
867
909
|
*/
|
|
868
910
|
getTelemetry(params) {
|
|
869
|
-
const { name, scope, page, perPage, attribute } = params || {};
|
|
911
|
+
const { name, scope, page, perPage, attribute, fromDate, toDate } = params || {};
|
|
870
912
|
const _attribute = attribute ? Object.entries(attribute).map(([key, value]) => `${key}:${value}`) : [];
|
|
871
913
|
const searchParams = new URLSearchParams();
|
|
872
914
|
if (name) {
|
|
@@ -890,6 +932,12 @@ var MastraClient = class extends BaseResource {
|
|
|
890
932
|
searchParams.set("attribute", _attribute);
|
|
891
933
|
}
|
|
892
934
|
}
|
|
935
|
+
if (fromDate) {
|
|
936
|
+
searchParams.set("fromDate", fromDate.toISOString());
|
|
937
|
+
}
|
|
938
|
+
if (toDate) {
|
|
939
|
+
searchParams.set("toDate", toDate.toISOString());
|
|
940
|
+
}
|
|
893
941
|
if (searchParams.size) {
|
|
894
942
|
return this.request(`/api/telemetry?${searchParams}`);
|
|
895
943
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/client-js",
|
|
3
|
-
"version": "0.1.20-alpha.
|
|
3
|
+
"version": "0.1.20-alpha.4",
|
|
4
4
|
"description": "The official TypeScript library for the Mastra Client API",
|
|
5
5
|
"author": "",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"json-schema": "^0.4.0",
|
|
27
27
|
"zod": "^3.24.2",
|
|
28
28
|
"zod-to-json-schema": "^3.24.3",
|
|
29
|
-
"@mastra/core": "^0.9.2-alpha.
|
|
29
|
+
"@mastra/core": "^0.9.2-alpha.4"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"zod": "^3.24.2"
|
package/src/client.ts
CHANGED
|
@@ -180,7 +180,7 @@ export class MastraClient extends BaseResource {
|
|
|
180
180
|
* @returns Promise containing telemetry data
|
|
181
181
|
*/
|
|
182
182
|
public getTelemetry(params?: GetTelemetryParams): Promise<GetTelemetryResponse> {
|
|
183
|
-
const { name, scope, page, perPage, attribute } = params || {};
|
|
183
|
+
const { name, scope, page, perPage, attribute, fromDate, toDate } = params || {};
|
|
184
184
|
const _attribute = attribute ? Object.entries(attribute).map(([key, value]) => `${key}:${value}`) : [];
|
|
185
185
|
|
|
186
186
|
const searchParams = new URLSearchParams();
|
|
@@ -205,6 +205,12 @@ export class MastraClient extends BaseResource {
|
|
|
205
205
|
searchParams.set('attribute', _attribute);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
+
if (fromDate) {
|
|
209
|
+
searchParams.set('fromDate', fromDate.toISOString());
|
|
210
|
+
}
|
|
211
|
+
if (toDate) {
|
|
212
|
+
searchParams.set('toDate', toDate.toISOString());
|
|
213
|
+
}
|
|
208
214
|
|
|
209
215
|
if (searchParams.size) {
|
|
210
216
|
return this.request(`/api/telemetry?${searchParams}`);
|
|
@@ -2,6 +2,7 @@ import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
|
2
2
|
import type {
|
|
3
3
|
ClientOptions,
|
|
4
4
|
GetVNextWorkflowResponse,
|
|
5
|
+
GetWorkflowRunsParams,
|
|
5
6
|
GetWorkflowRunsResponse,
|
|
6
7
|
VNextWorkflowRunResult,
|
|
7
8
|
VNextWorkflowWatchResult,
|
|
@@ -100,10 +101,32 @@ export class VNextWorkflow extends BaseResource {
|
|
|
100
101
|
|
|
101
102
|
/**
|
|
102
103
|
* Retrieves all runs for a vNext workflow
|
|
104
|
+
* @param params - Parameters for filtering runs
|
|
103
105
|
* @returns Promise containing vNext workflow runs array
|
|
104
106
|
*/
|
|
105
|
-
runs(): Promise<GetWorkflowRunsResponse> {
|
|
106
|
-
|
|
107
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse> {
|
|
108
|
+
const searchParams = new URLSearchParams();
|
|
109
|
+
if (params?.fromDate) {
|
|
110
|
+
searchParams.set('fromDate', params.fromDate.toISOString());
|
|
111
|
+
}
|
|
112
|
+
if (params?.toDate) {
|
|
113
|
+
searchParams.set('toDate', params.toDate.toISOString());
|
|
114
|
+
}
|
|
115
|
+
if (params?.limit) {
|
|
116
|
+
searchParams.set('limit', String(params.limit));
|
|
117
|
+
}
|
|
118
|
+
if (params?.offset) {
|
|
119
|
+
searchParams.set('offset', String(params.offset));
|
|
120
|
+
}
|
|
121
|
+
if (params?.resourceId) {
|
|
122
|
+
searchParams.set('resourceId', params.resourceId);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (searchParams.size) {
|
|
126
|
+
return this.request(`/api/workflows/v-next/${this.workflowId}/runs?${searchParams}`);
|
|
127
|
+
} else {
|
|
128
|
+
return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
|
|
129
|
+
}
|
|
107
130
|
}
|
|
108
131
|
|
|
109
132
|
/**
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
GetWorkflowResponse,
|
|
3
|
+
ClientOptions,
|
|
4
|
+
WorkflowRunResult,
|
|
5
|
+
GetWorkflowRunsResponse,
|
|
6
|
+
GetWorkflowRunsParams,
|
|
7
|
+
} from '../types';
|
|
2
8
|
|
|
3
9
|
import { BaseResource } from './base';
|
|
4
10
|
|
|
@@ -22,10 +28,32 @@ export class Workflow extends BaseResource {
|
|
|
22
28
|
|
|
23
29
|
/**
|
|
24
30
|
* Retrieves all runs for a workflow
|
|
31
|
+
* @param params - Parameters for filtering runs
|
|
25
32
|
* @returns Promise containing workflow runs array
|
|
26
33
|
*/
|
|
27
|
-
runs(): Promise<GetWorkflowRunsResponse> {
|
|
28
|
-
|
|
34
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse> {
|
|
35
|
+
const searchParams = new URLSearchParams();
|
|
36
|
+
if (params?.fromDate) {
|
|
37
|
+
searchParams.set('fromDate', params.fromDate.toISOString());
|
|
38
|
+
}
|
|
39
|
+
if (params?.toDate) {
|
|
40
|
+
searchParams.set('toDate', params.toDate.toISOString());
|
|
41
|
+
}
|
|
42
|
+
if (params?.limit) {
|
|
43
|
+
searchParams.set('limit', String(params.limit));
|
|
44
|
+
}
|
|
45
|
+
if (params?.offset) {
|
|
46
|
+
searchParams.set('offset', String(params.offset));
|
|
47
|
+
}
|
|
48
|
+
if (params?.resourceId) {
|
|
49
|
+
searchParams.set('resourceId', params.resourceId);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (searchParams.size) {
|
|
53
|
+
return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
|
|
54
|
+
} else {
|
|
55
|
+
return this.request(`/api/workflows/${this.workflowId}/runs`);
|
|
56
|
+
}
|
|
29
57
|
}
|
|
30
58
|
|
|
31
59
|
/**
|
package/src/types.ts
CHANGED
|
@@ -77,6 +77,14 @@ export interface GetWorkflowResponse {
|
|
|
77
77
|
workflowId?: string;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
export interface GetWorkflowRunsParams {
|
|
81
|
+
fromDate?: Date;
|
|
82
|
+
toDate?: Date;
|
|
83
|
+
limit?: number;
|
|
84
|
+
offset?: number;
|
|
85
|
+
resourceId?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
80
88
|
export type GetWorkflowRunsResponse = WorkflowRuns;
|
|
81
89
|
|
|
82
90
|
export type WorkflowRunResult = {
|
|
@@ -234,6 +242,8 @@ export interface GetTelemetryParams {
|
|
|
234
242
|
page?: number;
|
|
235
243
|
perPage?: number;
|
|
236
244
|
attribute?: Record<string, string>;
|
|
245
|
+
fromDate?: Date;
|
|
246
|
+
toDate?: Date;
|
|
237
247
|
}
|
|
238
248
|
|
|
239
249
|
export interface GetNetworkResponse {
|