@runwayml/sdk 3.16.0 → 3.17.0

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/client.d.mts +6 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +6 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +6 -0
  9. package/client.mjs.map +1 -1
  10. package/index.d.mts +1 -1
  11. package/index.d.mts.map +1 -1
  12. package/index.d.ts +1 -1
  13. package/index.d.ts.map +1 -1
  14. package/index.js +3 -1
  15. package/index.js.map +1 -1
  16. package/index.mjs +1 -1
  17. package/index.mjs.map +1 -1
  18. package/lib/polling.d.mts +22 -0
  19. package/lib/polling.d.mts.map +1 -1
  20. package/lib/polling.d.ts +22 -0
  21. package/lib/polling.d.ts.map +1 -1
  22. package/lib/polling.js +54 -1
  23. package/lib/polling.js.map +1 -1
  24. package/lib/polling.mjs +50 -0
  25. package/lib/polling.mjs.map +1 -1
  26. package/package.json +1 -1
  27. package/resources/index.d.mts +2 -0
  28. package/resources/index.d.mts.map +1 -1
  29. package/resources/index.d.ts +2 -0
  30. package/resources/index.d.ts.map +1 -1
  31. package/resources/index.js +5 -1
  32. package/resources/index.js.map +1 -1
  33. package/resources/index.mjs +2 -0
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/workflow-invocations.d.mts +195 -0
  36. package/resources/workflow-invocations.d.mts.map +1 -0
  37. package/resources/workflow-invocations.d.ts +195 -0
  38. package/resources/workflow-invocations.d.ts.map +1 -0
  39. package/resources/workflow-invocations.js +19 -0
  40. package/resources/workflow-invocations.js.map +1 -0
  41. package/resources/workflow-invocations.mjs +15 -0
  42. package/resources/workflow-invocations.mjs.map +1 -0
  43. package/resources/workflows.d.mts +171 -0
  44. package/resources/workflows.d.mts.map +1 -0
  45. package/resources/workflows.d.ts +171 -0
  46. package/resources/workflows.d.ts.map +1 -0
  47. package/resources/workflows.js +31 -0
  48. package/resources/workflows.js.map +1 -0
  49. package/resources/workflows.mjs +27 -0
  50. package/resources/workflows.mjs.map +1 -0
  51. package/src/client.ts +25 -0
  52. package/src/index.ts +3 -0
  53. package/src/lib/polling.ts +81 -0
  54. package/src/resources/index.ts +8 -0
  55. package/src/resources/workflow-invocations.ts +236 -0
  56. package/src/resources/workflows.ts +222 -0
  57. package/src/version.ts +1 -1
  58. package/version.d.mts +1 -1
  59. package/version.d.ts +1 -1
  60. package/version.js +1 -1
  61. package/version.mjs +1 -1
@@ -0,0 +1,236 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { RequestOptions } from '../internal/request-options';
5
+ import { path } from '../internal/utils/path';
6
+ import { APIPromiseWithAwaitableWorkflowInvocation, wrapAsWaitableWorkflowInvocation } from '../lib/polling';
7
+
8
+ export class WorkflowInvocations extends APIResource {
9
+ /**
10
+ * Return details about a workflow invocation. Consumers of this API should not
11
+ * expect updates more frequent than once every five seconds for a given workflow
12
+ * invocation.
13
+ */
14
+ retrieve(
15
+ id: string,
16
+ options?: RequestOptions,
17
+ ): APIPromiseWithAwaitableWorkflowInvocation<WorkflowInvocationRetrieveResponse> {
18
+ return wrapAsWaitableWorkflowInvocation<WorkflowInvocationRetrieveResponse>(this._client)(
19
+ this._client.get(path`/v1/workflow_invocations/${id}`, options),
20
+ true,
21
+ );
22
+ }
23
+ }
24
+
25
+ /**
26
+ * A pending workflow invocation
27
+ */
28
+ export type WorkflowInvocationRetrieveResponse =
29
+ | WorkflowInvocationRetrieveResponse.Pending
30
+ | WorkflowInvocationRetrieveResponse.Throttled
31
+ | WorkflowInvocationRetrieveResponse.Cancelled
32
+ | WorkflowInvocationRetrieveResponse.Running
33
+ | WorkflowInvocationRetrieveResponse.Failed
34
+ | WorkflowInvocationRetrieveResponse.Succeeded;
35
+
36
+ export namespace WorkflowInvocationRetrieveResponse {
37
+ /**
38
+ * A pending workflow invocation
39
+ */
40
+ export interface Pending {
41
+ /**
42
+ * The ID of the workflow invocation being returned.
43
+ */
44
+ id: string;
45
+
46
+ /**
47
+ * The timestamp that the workflow invocation was submitted at.
48
+ */
49
+ createdAt: string;
50
+
51
+ status: 'PENDING';
52
+ }
53
+
54
+ /**
55
+ * A throttled workflow invocation
56
+ */
57
+ export interface Throttled {
58
+ /**
59
+ * The ID of the workflow invocation being returned.
60
+ */
61
+ id: string;
62
+
63
+ /**
64
+ * The timestamp that the workflow invocation was submitted at.
65
+ */
66
+ createdAt: string;
67
+
68
+ status: 'THROTTLED';
69
+ }
70
+
71
+ /**
72
+ * A cancelled or deleted workflow invocation
73
+ */
74
+ export interface Cancelled {
75
+ /**
76
+ * The ID of the workflow invocation being returned.
77
+ */
78
+ id: string;
79
+
80
+ /**
81
+ * The timestamp that the workflow invocation was submitted at.
82
+ */
83
+ createdAt: string;
84
+
85
+ status: 'CANCELLED';
86
+ }
87
+
88
+ /**
89
+ * A running workflow invocation
90
+ */
91
+ export interface Running {
92
+ /**
93
+ * The ID of the workflow invocation being returned.
94
+ */
95
+ id: string;
96
+
97
+ /**
98
+ * The timestamp that the workflow invocation was submitted at.
99
+ */
100
+ createdAt: string;
101
+
102
+ /**
103
+ * A record mapping workflow node IDs to arrays of output URLs for nodes that have
104
+ * already completed. This allows streaming partial results while the workflow is
105
+ * still running.
106
+ */
107
+ output: { [key: string]: Array<string> };
108
+
109
+ /**
110
+ * A number between 0 and 1 representing the overall workflow execution progress.
111
+ */
112
+ progress: number;
113
+
114
+ status: 'RUNNING';
115
+
116
+ /**
117
+ * A record mapping workflow node IDs to their error details. Only present when one
118
+ * or more nodes have errored.
119
+ */
120
+ nodeErrors?: { [key: string]: Running.NodeErrors };
121
+ }
122
+
123
+ export namespace Running {
124
+ export interface NodeErrors {
125
+ /**
126
+ * A human-readable description of the node error.
127
+ */
128
+ message: string;
129
+
130
+ /**
131
+ * The human-readable name of the node that errored.
132
+ */
133
+ nodeName?: string;
134
+ }
135
+ }
136
+
137
+ /**
138
+ * A failed workflow invocation
139
+ */
140
+ export interface Failed {
141
+ /**
142
+ * The ID of the workflow invocation being returned.
143
+ */
144
+ id: string;
145
+
146
+ /**
147
+ * The timestamp that the workflow invocation was submitted at.
148
+ */
149
+ createdAt: string;
150
+
151
+ /**
152
+ * A human-friendly reason for the failure. We do not recommend returning this to
153
+ * users directly without adding context.
154
+ */
155
+ failure: string;
156
+
157
+ status: 'FAILED';
158
+
159
+ /**
160
+ * A machine-readable error code for the failure. See
161
+ * https://docs.dev.runwayml.com/errors/task-failures/ for more information.
162
+ */
163
+ failureCode?: string;
164
+
165
+ /**
166
+ * A record mapping workflow node IDs to their error details. Only present when one
167
+ * or more nodes have errored.
168
+ */
169
+ nodeErrors?: { [key: string]: Failed.NodeErrors };
170
+ }
171
+
172
+ export namespace Failed {
173
+ export interface NodeErrors {
174
+ /**
175
+ * A human-readable description of the node error.
176
+ */
177
+ message: string;
178
+
179
+ /**
180
+ * The human-readable name of the node that errored.
181
+ */
182
+ nodeName?: string;
183
+ }
184
+ }
185
+
186
+ /**
187
+ * A succeeded workflow invocation
188
+ */
189
+ export interface Succeeded {
190
+ /**
191
+ * The ID of the workflow invocation being returned.
192
+ */
193
+ id: string;
194
+
195
+ /**
196
+ * The timestamp that the workflow invocation was submitted at.
197
+ */
198
+ createdAt: string;
199
+
200
+ /**
201
+ * A record mapping workflow node IDs to arrays of output URLs. Each key is the
202
+ * UUID of a workflow node that produced output, and each value is an array of URLs
203
+ * for that node's artifacts. These URLs will expire within 24-48 hours; fetch the
204
+ * invocation again to get fresh URLs. It is expected that you download the assets
205
+ * at these URLs and store them in your own storage system.
206
+ */
207
+ output: { [key: string]: Array<string> };
208
+
209
+ status: 'SUCCEEDED';
210
+
211
+ /**
212
+ * A record mapping workflow node IDs to their error details. Even when the overall
213
+ * workflow succeeds, individual nodes may have encountered non-fatal errors. Only
214
+ * present when one or more nodes have errored.
215
+ */
216
+ nodeErrors?: { [key: string]: Succeeded.NodeErrors };
217
+ }
218
+
219
+ export namespace Succeeded {
220
+ export interface NodeErrors {
221
+ /**
222
+ * A human-readable description of the node error.
223
+ */
224
+ message: string;
225
+
226
+ /**
227
+ * The human-readable name of the node that errored.
228
+ */
229
+ nodeName?: string;
230
+ }
231
+ }
232
+ }
233
+
234
+ export declare namespace WorkflowInvocations {
235
+ export { type WorkflowInvocationRetrieveResponse as WorkflowInvocationRetrieveResponse };
236
+ }
@@ -0,0 +1,222 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+ import { path } from '../internal/utils/path';
7
+
8
+ export class Workflows extends APIResource {
9
+ /**
10
+ * Returns details about a specific published workflow, including its graph schema.
11
+ */
12
+ retrieve(id: string, options?: RequestOptions): APIPromise<WorkflowRetrieveResponse> {
13
+ return this._client.get(path`/v1/workflows/${id}`, options);
14
+ }
15
+
16
+ /**
17
+ * Returns a list of all published workflows for the authenticated user, grouped by
18
+ * source workflow with their published versions.
19
+ */
20
+ list(options?: RequestOptions): APIPromise<WorkflowListResponse> {
21
+ return this._client.get('/v1/workflows', options);
22
+ }
23
+
24
+ /**
25
+ * Start a new task to execute a published workflow. You can optionally provide
26
+ * custom input values via `nodeOutputs` to override the defaults defined in the
27
+ * workflow graph.
28
+ */
29
+ run(
30
+ id: string,
31
+ body: WorkflowRunParams | null | undefined = {},
32
+ options?: RequestOptions,
33
+ ): APIPromise<WorkflowRunResponse> {
34
+ return this._client.post(path`/v1/workflows/${id}`, { body, ...options });
35
+ }
36
+ }
37
+
38
+ export interface WorkflowRetrieveResponse {
39
+ /**
40
+ * The globally unique ID of the published workflow.
41
+ */
42
+ id: string;
43
+
44
+ /**
45
+ * When this version was published
46
+ */
47
+ createdAt: string;
48
+
49
+ /**
50
+ * The description of the published workflow.
51
+ */
52
+ description: string | null;
53
+
54
+ /**
55
+ * The workflow graph definition.
56
+ */
57
+ graph: WorkflowRetrieveResponse.Graph;
58
+
59
+ /**
60
+ * The name of the published workflow.
61
+ */
62
+ name: string;
63
+
64
+ /**
65
+ * When this version was last updated
66
+ */
67
+ updatedAt: string;
68
+
69
+ /**
70
+ * A monotonically increasing version number. Each workflow version for the same
71
+ * published workflow has a unique version number.
72
+ */
73
+ version: number;
74
+ }
75
+
76
+ export namespace WorkflowRetrieveResponse {
77
+ /**
78
+ * The workflow graph definition.
79
+ */
80
+ export interface Graph {
81
+ /**
82
+ * The list of edges connecting nodes in the workflow graph.
83
+ */
84
+ edges: Array<unknown>;
85
+
86
+ /**
87
+ * The list of nodes in the workflow graph.
88
+ */
89
+ nodes: Array<unknown>;
90
+
91
+ /**
92
+ * The schema version of the workflow graph format.
93
+ */
94
+ version: number;
95
+ }
96
+ }
97
+
98
+ export interface WorkflowListResponse {
99
+ /**
100
+ * A list of published workflows grouped by source workflow.
101
+ */
102
+ data: Array<WorkflowListResponse.Data>;
103
+ }
104
+
105
+ export namespace WorkflowListResponse {
106
+ /**
107
+ * A published workflow with all its available versions.
108
+ */
109
+ export interface Data {
110
+ /**
111
+ * The name of the published workflow.
112
+ */
113
+ name: string;
114
+
115
+ /**
116
+ * The published versions of this workflow, newest first.
117
+ */
118
+ versions: Array<Data.Version>;
119
+ }
120
+
121
+ export namespace Data {
122
+ /**
123
+ * A specific published version of a workflow.
124
+ */
125
+ export interface Version {
126
+ /**
127
+ * The globally unique ID of this published workflow version.
128
+ */
129
+ id: string;
130
+
131
+ /**
132
+ * When this version was published
133
+ */
134
+ createdAt: string;
135
+
136
+ /**
137
+ * A monotonically increasing version number. Each workflow version for the same
138
+ * published workflow has a unique version number.
139
+ */
140
+ version: number;
141
+ }
142
+ }
143
+ }
144
+
145
+ export interface WorkflowRunResponse {
146
+ /**
147
+ * The ID of the workflow invocation that was created.
148
+ */
149
+ id: string;
150
+ }
151
+
152
+ export interface WorkflowRunParams {
153
+ /**
154
+ * Optional node outputs to override default values. Keys are node IDs from the
155
+ * workflow graph, values are objects mapping output keys to typed values.
156
+ */
157
+ nodeOutputs?: {
158
+ [key: string]: {
159
+ [key: string]:
160
+ | WorkflowRunParams.Primitive
161
+ | WorkflowRunParams.Image
162
+ | WorkflowRunParams.Video
163
+ | WorkflowRunParams.Audio;
164
+ };
165
+ };
166
+ }
167
+
168
+ export namespace WorkflowRunParams {
169
+ /**
170
+ * A primitive value (string, number, or boolean)
171
+ */
172
+ export interface Primitive {
173
+ type: 'primitive';
174
+
175
+ value: string | number | boolean;
176
+ }
177
+
178
+ /**
179
+ * An image asset
180
+ */
181
+ export interface Image {
182
+ type: 'image';
183
+
184
+ /**
185
+ * A HTTPS URL.
186
+ */
187
+ uri: string;
188
+ }
189
+
190
+ /**
191
+ * A video asset
192
+ */
193
+ export interface Video {
194
+ type: 'video';
195
+
196
+ /**
197
+ * A HTTPS URL.
198
+ */
199
+ uri: string;
200
+ }
201
+
202
+ /**
203
+ * An audio asset
204
+ */
205
+ export interface Audio {
206
+ type: 'audio';
207
+
208
+ /**
209
+ * A HTTPS URL.
210
+ */
211
+ uri: string;
212
+ }
213
+ }
214
+
215
+ export declare namespace Workflows {
216
+ export {
217
+ type WorkflowRetrieveResponse as WorkflowRetrieveResponse,
218
+ type WorkflowListResponse as WorkflowListResponse,
219
+ type WorkflowRunResponse as WorkflowRunResponse,
220
+ type WorkflowRunParams as WorkflowRunParams,
221
+ };
222
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '3.16.0'; // x-release-please-version
1
+ export const VERSION = '3.17.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.16.0";
1
+ export declare const VERSION = "3.17.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.16.0";
1
+ export declare const VERSION = "3.17.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '3.16.0'; // x-release-please-version
4
+ exports.VERSION = '3.17.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.16.0'; // x-release-please-version
1
+ export const VERSION = '3.17.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map