@happyrobot-ai/sdk 0.1.19 → 0.1.20
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 -2
- package/package.json +1 -1
- package/resources/workflows.d.ts +3 -3
- package/resources/workflows.js +3 -2
- package/types/workflows.types.d.ts +2 -1
- package/types/common.types.d.ts +0 -19
- package/types/common.types.js +0 -7
- package/types/common.types.mjs +0 -1
package/README.md
CHANGED
|
@@ -168,8 +168,9 @@ await client.workflows.duplicate("my-workflow", { name: "Copy" });
|
|
|
168
168
|
await client.workflows.publish("my-workflow");
|
|
169
169
|
await client.workflows.unpublish("my-workflow");
|
|
170
170
|
|
|
171
|
-
// Cancel
|
|
171
|
+
// Cancel current and queued runs. By default, this also unpublishes the workflow.
|
|
172
172
|
await client.workflows.cancelRuns("my-workflow");
|
|
173
|
+
await client.workflows.cancelRuns("my-workflow", { unpublish_workflow: false });
|
|
173
174
|
|
|
174
175
|
// List templates
|
|
175
176
|
const { data } = await client.workflows.listTemplates();
|
|
@@ -195,7 +196,7 @@ const { run_id } = await client.workflows.triggerRun("my-workflow", { payload: {
|
|
|
195
196
|
| `duplicate(workflowId, body?)` | POST | `/workflows/:id/duplicate` | Duplicate a workflow |
|
|
196
197
|
| `publish(workflowId, body?)` | POST | `/workflows/:id/publish` | Publish the latest version |
|
|
197
198
|
| `unpublish(workflowId)` | POST | `/workflows/:id/unpublish` | Unpublish a workflow |
|
|
198
|
-
| `cancelRuns(workflowId)`
|
|
199
|
+
| `cancelRuns(workflowId, body?)` | POST | `/workflows/:id/cancel-runs` | Cancel current and queued runs |
|
|
199
200
|
| `listTemplates(query?)` | GET | `/workflows/templates` | List workflow templates |
|
|
200
201
|
| `listVersions(workflowId, query?)` | GET | `/workflows/:id/versions` | List versions for a workflow |
|
|
201
202
|
| `listRuns(workflowId, query?)` | GET | `/workflows/:id/runs` | List runs for a workflow |
|
package/package.json
CHANGED
package/resources/workflows.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import type { HttpClient } from "../core/http";
|
|
20
20
|
import type { WorkflowRunsQuery, PaginatedWorkflowRunsResponse, TriggerRunBody, TriggerRunResponse, TriggerRunWithFileBody } from "../types/runs.types";
|
|
21
|
-
import type { ListWorkflowsQuery, WorkflowListItem, PaginatedWorkflowsResponse, CreateWorkflowBody, CreateWorkflowResponse, WorkflowDetailResponse, UpdateWorkflowBody, UpdateWorkflowResponse, DuplicateWorkflowBody, DuplicateWorkflowResponse, ListTemplatesQuery, PaginatedTemplatesResponse, WorkflowPublishResponse, WorkflowUnpublishResponse, CancelRunsResponse, ListWorkflowVersionsQuery, PaginatedWorkflowVersionsResponse } from "../types/workflows.types";
|
|
21
|
+
import type { ListWorkflowsQuery, WorkflowListItem, PaginatedWorkflowsResponse, CreateWorkflowBody, CreateWorkflowResponse, WorkflowDetailResponse, UpdateWorkflowBody, UpdateWorkflowResponse, DuplicateWorkflowBody, DuplicateWorkflowResponse, ListTemplatesQuery, PaginatedTemplatesResponse, WorkflowPublishResponse, WorkflowUnpublishResponse, CancelRunsBody, CancelRunsResponse, ListWorkflowVersionsQuery, PaginatedWorkflowVersionsResponse } from "../types/workflows.types";
|
|
22
22
|
export declare class WorkflowsResource {
|
|
23
23
|
private readonly http;
|
|
24
24
|
constructor(http: HttpClient);
|
|
@@ -42,8 +42,8 @@ export declare class WorkflowsResource {
|
|
|
42
42
|
}): Promise<WorkflowPublishResponse>;
|
|
43
43
|
/** Unpublish a workflow. */
|
|
44
44
|
unpublish(workflowId: string): Promise<WorkflowUnpublishResponse>;
|
|
45
|
-
/** Cancel
|
|
46
|
-
cancelRuns(workflowId: string): Promise<CancelRunsResponse>;
|
|
45
|
+
/** Cancel current and queued runs for a workflow. By default, this also unpublishes it. */
|
|
46
|
+
cancelRuns(workflowId: string, body?: CancelRunsBody): Promise<CancelRunsResponse>;
|
|
47
47
|
/** List templates for workflow creation. */
|
|
48
48
|
listTemplates(query?: ListTemplatesQuery): Promise<PaginatedTemplatesResponse>;
|
|
49
49
|
/** List versions for a workflow. */
|
package/resources/workflows.js
CHANGED
|
@@ -90,11 +90,12 @@ class WorkflowsResource {
|
|
|
90
90
|
path: `/workflows/${encodeURIComponent(workflowId)}/unpublish`,
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
/** Cancel
|
|
94
|
-
async cancelRuns(workflowId) {
|
|
93
|
+
/** Cancel current and queued runs for a workflow. By default, this also unpublishes it. */
|
|
94
|
+
async cancelRuns(workflowId, body) {
|
|
95
95
|
return this.http.request({
|
|
96
96
|
method: "POST",
|
|
97
97
|
path: `/workflows/${encodeURIComponent(workflowId)}/cancel-runs`,
|
|
98
|
+
...(body ? { body } : {}),
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
/** List templates for workflow creation. */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Uses import type — erased at compile time.
|
|
4
4
|
*/
|
|
5
5
|
import type { z } from "zod";
|
|
6
|
-
import type { ListWorkflowsQuerySchema, WorkflowListItemSchema, PaginatedWorkflowsResponseSchema, CreateWorkflowBodySchema, CreateWorkflowResponseSchema, WorkflowDetailResponseSchema, UpdateWorkflowBodySchema, UpdateWorkflowResponseSchema, DuplicateWorkflowBodySchema, DuplicateWorkflowResponseSchema, PaginatedTemplatesResponseSchema, ListTemplatesQuerySchema, WorkflowPublishResponseSchema, WorkflowPublishErrorResponseSchema, WorkflowUnpublishResponseSchema, CancelRunsResponseSchema, ListWorkflowVersionsQuerySchema, PaginatedWorkflowVersionsResponseSchema } from "../../routes/workflows/schemas";
|
|
6
|
+
import type { ListWorkflowsQuerySchema, WorkflowListItemSchema, PaginatedWorkflowsResponseSchema, CreateWorkflowBodySchema, CreateWorkflowResponseSchema, WorkflowDetailResponseSchema, UpdateWorkflowBodySchema, UpdateWorkflowResponseSchema, DuplicateWorkflowBodySchema, DuplicateWorkflowResponseSchema, PaginatedTemplatesResponseSchema, ListTemplatesQuerySchema, WorkflowPublishResponseSchema, WorkflowPublishErrorResponseSchema, WorkflowUnpublishResponseSchema, CancelRunsBodySchema, CancelRunsResponseSchema, ListWorkflowVersionsQuerySchema, PaginatedWorkflowVersionsResponseSchema } from "../../routes/workflows/schemas";
|
|
7
7
|
export type ListWorkflowsQuery = z.output<typeof ListWorkflowsQuerySchema>;
|
|
8
8
|
export type WorkflowListItem = z.infer<typeof WorkflowListItemSchema>;
|
|
9
9
|
export type PaginatedWorkflowsResponse = z.infer<typeof PaginatedWorkflowsResponseSchema>;
|
|
@@ -19,6 +19,7 @@ export type PaginatedTemplatesResponse = z.infer<typeof PaginatedTemplatesRespon
|
|
|
19
19
|
export type WorkflowPublishResponse = z.infer<typeof WorkflowPublishResponseSchema>;
|
|
20
20
|
export type WorkflowPublishErrorResponse = z.infer<typeof WorkflowPublishErrorResponseSchema>;
|
|
21
21
|
export type WorkflowUnpublishResponse = z.infer<typeof WorkflowUnpublishResponseSchema>;
|
|
22
|
+
export type CancelRunsBody = z.input<typeof CancelRunsBodySchema>;
|
|
22
23
|
export type CancelRunsResponse = z.infer<typeof CancelRunsResponseSchema>;
|
|
23
24
|
export type ListWorkflowVersionsQuery = z.input<typeof ListWorkflowVersionsQuerySchema>;
|
|
24
25
|
export type PaginatedWorkflowVersionsResponse = z.infer<typeof PaginatedWorkflowVersionsResponseSchema>;
|
package/types/common.types.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common types shared across the SDK.
|
|
3
|
-
* Extracted from Zod schemas using import type only — zero runtime cost.
|
|
4
|
-
*/
|
|
5
|
-
import type { z } from "zod";
|
|
6
|
-
import type { PaginationMetadataSchema } from "../../routes/shared/pagination";
|
|
7
|
-
export type PaginationMetadata = z.infer<typeof PaginationMetadataSchema>;
|
|
8
|
-
/** Standard paginated response shape. */
|
|
9
|
-
export interface PaginatedResponse<T> {
|
|
10
|
-
data: T[];
|
|
11
|
-
pagination: PaginationMetadata;
|
|
12
|
-
}
|
|
13
|
-
/** Standard error response shape. */
|
|
14
|
-
export interface ErrorResponse {
|
|
15
|
-
error: string;
|
|
16
|
-
message: string;
|
|
17
|
-
statusCode: number;
|
|
18
|
-
details?: unknown;
|
|
19
|
-
}
|
package/types/common.types.js
DELETED
package/types/common.types.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./common.types.js";
|