@mastra/client-js 0.1.14-alpha.2 → 0.1.14-alpha.3
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 +17 -0
- package/dist/index.cjs +8 -3
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +8 -3
- package/package.json +2 -2
- package/src/index.test.ts +4 -3
- package/src/resources/workflow.ts +11 -4
- package/src/types.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/client-js@0.1.14-alpha.
|
|
2
|
+
> @mastra/client-js@0.1.14-alpha.3 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
|
-
[32mESM[39m [1mdist/index.js [22m[32m21.
|
|
13
|
-
[32mESM[39m ⚡️ Build success in
|
|
14
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m21.
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m [1mdist/index.js [22m[32m21.30 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 809ms
|
|
14
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m21.48 KB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 810ms
|
|
16
16
|
[34mDTS[39m Build start
|
|
17
|
-
[32mDTS[39m ⚡️ Build success in
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m18.
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[32m18.
|
|
17
|
+
[32mDTS[39m ⚡️ Build success in 12001ms
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m18.97 KB[39m
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m18.97 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 0.1.14-alpha.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 789bef3: Make runId optional for workflow startAsync api
|
|
8
|
+
- 8393832: Handle nested workflow view on workflow graph
|
|
9
|
+
- Updated dependencies [5ae0180]
|
|
10
|
+
- Updated dependencies [9bfa12b]
|
|
11
|
+
- Updated dependencies [515ebfb]
|
|
12
|
+
- Updated dependencies [88fa727]
|
|
13
|
+
- Updated dependencies [f37f535]
|
|
14
|
+
- Updated dependencies [4d67826]
|
|
15
|
+
- Updated dependencies [6330967]
|
|
16
|
+
- Updated dependencies [8393832]
|
|
17
|
+
- Updated dependencies [6330967]
|
|
18
|
+
- @mastra/core@0.8.0-alpha.3
|
|
19
|
+
|
|
3
20
|
## 0.1.14-alpha.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -373,6 +373,7 @@ var Workflow = class extends BaseResource {
|
|
|
373
373
|
return this.request(`/api/workflows/${this.workflowId}`);
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
|
+
* @deprecated Use `startAsync` instead
|
|
376
377
|
* Executes the workflow with the provided parameters
|
|
377
378
|
* @param params - Parameters required for workflow execution
|
|
378
379
|
* @returns Promise containing the workflow execution results
|
|
@@ -429,11 +430,15 @@ var Workflow = class extends BaseResource {
|
|
|
429
430
|
}
|
|
430
431
|
/**
|
|
431
432
|
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
432
|
-
* @param params - Object containing the runId and triggerData
|
|
433
|
+
* @param params - Object containing the optional runId and triggerData
|
|
433
434
|
* @returns Promise containing the workflow execution results
|
|
434
435
|
*/
|
|
435
436
|
startAsync(params) {
|
|
436
|
-
|
|
437
|
+
const searchParams = new URLSearchParams();
|
|
438
|
+
if (!!params?.runId) {
|
|
439
|
+
searchParams.set("runId", params.runId);
|
|
440
|
+
}
|
|
441
|
+
return this.request(`/api/workflows/${this.workflowId}/start-async?${searchParams.toString()}`, {
|
|
437
442
|
method: "POST",
|
|
438
443
|
body: params?.triggerData
|
|
439
444
|
});
|
|
@@ -444,7 +449,7 @@ var Workflow = class extends BaseResource {
|
|
|
444
449
|
* @returns Promise containing the workflow resume results
|
|
445
450
|
*/
|
|
446
451
|
resumeAsync(params) {
|
|
447
|
-
return this.request(`/api/workflows/${this.workflowId}/
|
|
452
|
+
return this.request(`/api/workflows/${this.workflowId}/resume-async?runId=${params.runId}`, {
|
|
448
453
|
method: "POST",
|
|
449
454
|
body: {
|
|
450
455
|
stepId: params.stepId,
|
package/dist/index.d.cts
CHANGED
|
@@ -51,6 +51,7 @@ interface GetWorkflowResponse {
|
|
|
51
51
|
steps: Record<string, StepAction<any, any, any, any>>;
|
|
52
52
|
stepGraph: StepGraph;
|
|
53
53
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
54
|
+
workflowId?: string;
|
|
54
55
|
}
|
|
55
56
|
type WorkflowRunResult = {
|
|
56
57
|
activePaths: Record<string, {
|
|
@@ -339,6 +340,7 @@ declare class Workflow extends BaseResource {
|
|
|
339
340
|
*/
|
|
340
341
|
details(): Promise<GetWorkflowResponse>;
|
|
341
342
|
/**
|
|
343
|
+
* @deprecated Use `startAsync` instead
|
|
342
344
|
* Executes the workflow with the provided parameters
|
|
343
345
|
* @param params - Parameters required for workflow execution
|
|
344
346
|
* @returns Promise containing the workflow execution results
|
|
@@ -380,11 +382,11 @@ declare class Workflow extends BaseResource {
|
|
|
380
382
|
}>;
|
|
381
383
|
/**
|
|
382
384
|
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
383
|
-
* @param params - Object containing the runId and triggerData
|
|
385
|
+
* @param params - Object containing the optional runId and triggerData
|
|
384
386
|
* @returns Promise containing the workflow execution results
|
|
385
387
|
*/
|
|
386
388
|
startAsync(params: {
|
|
387
|
-
runId
|
|
389
|
+
runId?: string;
|
|
388
390
|
triggerData: Record<string, any>;
|
|
389
391
|
}): Promise<WorkflowRunResult>;
|
|
390
392
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ interface GetWorkflowResponse {
|
|
|
51
51
|
steps: Record<string, StepAction<any, any, any, any>>;
|
|
52
52
|
stepGraph: StepGraph;
|
|
53
53
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
54
|
+
workflowId?: string;
|
|
54
55
|
}
|
|
55
56
|
type WorkflowRunResult = {
|
|
56
57
|
activePaths: Record<string, {
|
|
@@ -339,6 +340,7 @@ declare class Workflow extends BaseResource {
|
|
|
339
340
|
*/
|
|
340
341
|
details(): Promise<GetWorkflowResponse>;
|
|
341
342
|
/**
|
|
343
|
+
* @deprecated Use `startAsync` instead
|
|
342
344
|
* Executes the workflow with the provided parameters
|
|
343
345
|
* @param params - Parameters required for workflow execution
|
|
344
346
|
* @returns Promise containing the workflow execution results
|
|
@@ -380,11 +382,11 @@ declare class Workflow extends BaseResource {
|
|
|
380
382
|
}>;
|
|
381
383
|
/**
|
|
382
384
|
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
383
|
-
* @param params - Object containing the runId and triggerData
|
|
385
|
+
* @param params - Object containing the optional runId and triggerData
|
|
384
386
|
* @returns Promise containing the workflow execution results
|
|
385
387
|
*/
|
|
386
388
|
startAsync(params: {
|
|
387
|
-
runId
|
|
389
|
+
runId?: string;
|
|
388
390
|
triggerData: Record<string, any>;
|
|
389
391
|
}): Promise<WorkflowRunResult>;
|
|
390
392
|
/**
|
package/dist/index.js
CHANGED
|
@@ -371,6 +371,7 @@ var Workflow = class extends BaseResource {
|
|
|
371
371
|
return this.request(`/api/workflows/${this.workflowId}`);
|
|
372
372
|
}
|
|
373
373
|
/**
|
|
374
|
+
* @deprecated Use `startAsync` instead
|
|
374
375
|
* Executes the workflow with the provided parameters
|
|
375
376
|
* @param params - Parameters required for workflow execution
|
|
376
377
|
* @returns Promise containing the workflow execution results
|
|
@@ -427,11 +428,15 @@ var Workflow = class extends BaseResource {
|
|
|
427
428
|
}
|
|
428
429
|
/**
|
|
429
430
|
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
430
|
-
* @param params - Object containing the runId and triggerData
|
|
431
|
+
* @param params - Object containing the optional runId and triggerData
|
|
431
432
|
* @returns Promise containing the workflow execution results
|
|
432
433
|
*/
|
|
433
434
|
startAsync(params) {
|
|
434
|
-
|
|
435
|
+
const searchParams = new URLSearchParams();
|
|
436
|
+
if (!!params?.runId) {
|
|
437
|
+
searchParams.set("runId", params.runId);
|
|
438
|
+
}
|
|
439
|
+
return this.request(`/api/workflows/${this.workflowId}/start-async?${searchParams.toString()}`, {
|
|
435
440
|
method: "POST",
|
|
436
441
|
body: params?.triggerData
|
|
437
442
|
});
|
|
@@ -442,7 +447,7 @@ var Workflow = class extends BaseResource {
|
|
|
442
447
|
* @returns Promise containing the workflow resume results
|
|
443
448
|
*/
|
|
444
449
|
resumeAsync(params) {
|
|
445
|
-
return this.request(`/api/workflows/${this.workflowId}/
|
|
450
|
+
return this.request(`/api/workflows/${this.workflowId}/resume-async?runId=${params.runId}`, {
|
|
446
451
|
method: "POST",
|
|
447
452
|
body: {
|
|
448
453
|
stepId: params.stepId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/client-js",
|
|
3
|
-
"version": "0.1.14-alpha.
|
|
3
|
+
"version": "0.1.14-alpha.3",
|
|
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.8.0-alpha.
|
|
29
|
+
"@mastra/core": "^0.8.0-alpha.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/preset-env": "^7.26.9",
|
package/src/index.test.ts
CHANGED
|
@@ -12,6 +12,7 @@ describe('MastraClient Resources', () => {
|
|
|
12
12
|
baseUrl: 'http://localhost:4111',
|
|
13
13
|
headers: {
|
|
14
14
|
Authorization: 'Bearer test-key',
|
|
15
|
+
'x-mastra-client-type': 'js',
|
|
15
16
|
},
|
|
16
17
|
};
|
|
17
18
|
|
|
@@ -631,14 +632,14 @@ describe('MastraClient Resources', () => {
|
|
|
631
632
|
};
|
|
632
633
|
mockFetchResponse(mockResponse);
|
|
633
634
|
|
|
634
|
-
const result = await workflow.
|
|
635
|
+
const result = await workflow.startAsync({ triggerData: { test: 'test' } });
|
|
635
636
|
expect(result).toEqual(mockResponse);
|
|
636
637
|
expect(global.fetch).toHaveBeenCalledWith(
|
|
637
|
-
`${clientOptions.baseUrl}/api/workflows/test-workflow/
|
|
638
|
+
`${clientOptions.baseUrl}/api/workflows/test-workflow/start-async?`,
|
|
638
639
|
expect.objectContaining({
|
|
639
640
|
method: 'POST',
|
|
640
641
|
headers: expect.objectContaining(clientOptions.headers),
|
|
641
|
-
body: JSON.stringify({
|
|
642
|
+
body: JSON.stringify({ test: 'test' }),
|
|
642
643
|
}),
|
|
643
644
|
);
|
|
644
645
|
});
|
|
@@ -21,6 +21,7 @@ export class Workflow extends BaseResource {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
+
* @deprecated Use `startAsync` instead
|
|
24
25
|
* Executes the workflow with the provided parameters
|
|
25
26
|
* @param params - Parameters required for workflow execution
|
|
26
27
|
* @returns Promise containing the workflow execution results
|
|
@@ -87,11 +88,17 @@ export class Workflow extends BaseResource {
|
|
|
87
88
|
|
|
88
89
|
/**
|
|
89
90
|
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
90
|
-
* @param params - Object containing the runId and triggerData
|
|
91
|
+
* @param params - Object containing the optional runId and triggerData
|
|
91
92
|
* @returns Promise containing the workflow execution results
|
|
92
93
|
*/
|
|
93
|
-
startAsync(params: { runId
|
|
94
|
-
|
|
94
|
+
startAsync(params: { runId?: string; triggerData: Record<string, any> }): Promise<WorkflowRunResult> {
|
|
95
|
+
const searchParams = new URLSearchParams();
|
|
96
|
+
|
|
97
|
+
if (!!params?.runId) {
|
|
98
|
+
searchParams.set('runId', params.runId);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return this.request(`/api/workflows/${this.workflowId}/start-async?${searchParams.toString()}`, {
|
|
95
102
|
method: 'POST',
|
|
96
103
|
body: params?.triggerData,
|
|
97
104
|
});
|
|
@@ -103,7 +110,7 @@ export class Workflow extends BaseResource {
|
|
|
103
110
|
* @returns Promise containing the workflow resume results
|
|
104
111
|
*/
|
|
105
112
|
resumeAsync(params: { runId: string; stepId: string; context: Record<string, any> }): Promise<WorkflowRunResult> {
|
|
106
|
-
return this.request(`/api/workflows/${this.workflowId}/
|
|
113
|
+
return this.request(`/api/workflows/${this.workflowId}/resume-async?runId=${params.runId}`, {
|
|
107
114
|
method: 'POST',
|
|
108
115
|
body: {
|
|
109
116
|
stepId: params.stepId,
|
package/src/types.ts
CHANGED