@mastra/client-js 1.36.1-alpha.2 → 1.37.0-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/dist/index.js CHANGED
@@ -4645,6 +4645,30 @@ var StoredAgent = class extends BaseResource {
4645
4645
  }
4646
4646
  };
4647
4647
  //#endregion
4648
+ //#region src/resources/stored-workflow.ts
4649
+ /** Resource for interacting with a specific stored workflow definition. */
4650
+ var StoredWorkflow = class extends BaseResource {
4651
+ storedWorkflowId;
4652
+ constructor(options, storedWorkflowId) {
4653
+ super(options);
4654
+ this.storedWorkflowId = storedWorkflowId;
4655
+ }
4656
+ /**
4657
+ * Retrieves the full stored workflow definition (schemas, graph, status, metadata)
4658
+ * @returns Promise containing the stored workflow definition
4659
+ */
4660
+ details() {
4661
+ return this.request(`/stored/workflows/${encodeURIComponent(this.storedWorkflowId)}`);
4662
+ }
4663
+ /**
4664
+ * Deletes the stored workflow definition and unregisters it from the server
4665
+ * @returns Promise containing the deletion result
4666
+ */
4667
+ delete() {
4668
+ return this.request(`/stored/workflows/${encodeURIComponent(this.storedWorkflowId)}`, { method: "DELETE" });
4669
+ }
4670
+ };
4671
+ //#endregion
4648
4672
  //#region src/resources/stored-prompt-block.ts
4649
4673
  /**
4650
4674
  * Resource for interacting with a specific stored prompt block
@@ -6697,6 +6721,40 @@ var MastraClient = class extends BaseResource {
6697
6721
  return new StoredAgent(this.options, storedAgentId);
6698
6722
  }
6699
6723
  /**
6724
+ * Lists stored workflow definitions, optionally filtered by status or author
6725
+ * @param params - Optional filters: `status` ('active' | 'archived') and `authorId`
6726
+ * @returns Promise containing the matching definitions and a total count
6727
+ */
6728
+ listStoredWorkflows(params) {
6729
+ const searchParams = new URLSearchParams();
6730
+ if (params?.status) searchParams.set("status", params.status);
6731
+ if (params?.authorId) searchParams.set("authorId", params.authorId);
6732
+ const queryString = searchParams.toString();
6733
+ return this.request(`/stored/workflows${queryString ? `?${queryString}` : ""}`);
6734
+ }
6735
+ /**
6736
+ * Creates or replaces a stored workflow definition and live-registers it on the server.
6737
+ * Optional `dependencies` lets helper workflows referenced by the root definition be
6738
+ * saved in the same request; their ids are echoed back as `dependencyIds`.
6739
+ * @param params - The workflow definition (id, schemas, graph) plus optional helper dependencies
6740
+ * @returns Promise containing the persisted definition and any dependency ids
6741
+ */
6742
+ upsertStoredWorkflow(params) {
6743
+ return this.request("/stored/workflows", {
6744
+ method: "POST",
6745
+ body: params
6746
+ });
6747
+ }
6748
+ /**
6749
+ * Gets a stored workflow instance by ID for further operations (details, delete).
6750
+ * To execute a stored workflow, use `getWorkflow(id).createRun()` like any other workflow.
6751
+ * @param storedWorkflowId - ID of the stored workflow definition
6752
+ * @returns StoredWorkflow instance
6753
+ */
6754
+ getStoredWorkflow(storedWorkflowId) {
6755
+ return new StoredWorkflow(this.options, storedWorkflowId);
6756
+ }
6757
+ /**
6700
6758
  * Lists all stored prompt blocks with optional pagination
6701
6759
  * @param params - Optional pagination and ordering parameters
6702
6760
  * @returns Promise containing paginated list of stored prompt blocks