@happyrobot-ai/sdk 0.1.19 → 0.1.21

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 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 all active runs
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)` | POST | `/workflows/:id/cancel-runs` | Cancel all active runs |
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyrobot-ai/sdk",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "TypeScript SDK for the HappyRobot Public API",
5
5
  "main": "./index.js",
6
6
  "module": "./index.mjs",
@@ -10,6 +10,7 @@
10
10
  * GET /versions/:version_id/nodes/:node_id/config-schema
11
11
  * GET /versions/:version_id/nodes/:node_id/available-vars
12
12
  * POST /versions/:version_id/nodes/:node_id/test
13
+ * PUT /versions/:version_id/nodes/:node_id/custom-output
13
14
  */
14
15
  import type { HttpClient } from "../core/http";
15
16
  import type { AvailableVarsResponse, ConfigSchemaResponse } from "../types/nodes.types";
@@ -47,4 +48,14 @@ export declare class NodesResource {
47
48
  getAvailableVars(versionId: string, nodeId: string): Promise<AvailableVarsResponse>;
48
49
  /** Test a single node. The version must not be published. */
49
50
  test(versionId: string, nodeId: string, body?: TestNodeBody): Promise<TestNodeResponse>;
51
+ /** Set a custom JSON object as a node's output for testing. */
52
+ setCustomOutput(versionId: string, nodeId: string, data: Record<string, unknown>): Promise<CustomOutputResponse>;
53
+ }
54
+ export interface CustomOutputResponse {
55
+ data: {
56
+ id: string;
57
+ node_id: string;
58
+ data: Record<string, unknown> | null;
59
+ timestamp: string;
60
+ };
50
61
  }
@@ -11,6 +11,7 @@
11
11
  * GET /versions/:version_id/nodes/:node_id/config-schema
12
12
  * GET /versions/:version_id/nodes/:node_id/available-vars
13
13
  * POST /versions/:version_id/nodes/:node_id/test
14
+ * PUT /versions/:version_id/nodes/:node_id/custom-output
14
15
  */
15
16
  Object.defineProperty(exports, "__esModule", { value: true });
16
17
  exports.NodesResource = void 0;
@@ -78,6 +79,14 @@ class NodesResource {
78
79
  body: body ?? {},
79
80
  });
80
81
  }
82
+ /** Set a custom JSON object as a node's output for testing. */
83
+ async setCustomOutput(versionId, nodeId, data) {
84
+ return this.http.request({
85
+ method: "PUT",
86
+ path: `/versions/${enc(versionId)}/nodes/${enc(nodeId)}/custom-output`,
87
+ body: { data },
88
+ });
89
+ }
81
90
  }
82
91
  exports.NodesResource = NodesResource;
83
92
  function enc(s) {
@@ -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 all active runs for a workflow. */
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. */
@@ -90,11 +90,12 @@ class WorkflowsResource {
90
90
  path: `/workflows/${encodeURIComponent(workflowId)}/unpublish`,
91
91
  });
92
92
  }
93
- /** Cancel all active runs for a workflow. */
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>;
@@ -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
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * Common types shared across the SDK.
4
- * Extracted from Zod schemas using import type only — zero runtime cost.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=common.types.js.map
@@ -1 +0,0 @@
1
- export * from "./common.types.js";