@skyvern/client 1.0.3 → 1.0.6

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 (92) hide show
  1. package/README.md +45 -0
  2. package/dist/cjs/Client.d.ts +17 -1
  3. package/dist/cjs/Client.js +80 -6
  4. package/dist/cjs/api/client/requests/BodyUploadFileV1UploadFilePost.d.ts +10 -0
  5. package/dist/cjs/api/client/requests/BodyUploadFileV1UploadFilePost.js +3 -0
  6. package/dist/cjs/api/client/requests/GetWorkflowsRequest.d.ts +2 -0
  7. package/dist/cjs/api/client/requests/index.d.ts +1 -0
  8. package/dist/cjs/api/types/Action.d.ts +1 -0
  9. package/dist/cjs/api/types/Artifact.d.ts +1 -0
  10. package/dist/cjs/api/types/PromptAction.d.ts +1 -1
  11. package/dist/cjs/api/types/RetryRunWebhookRequest.d.ts +4 -0
  12. package/dist/cjs/api/types/RetryRunWebhookRequest.js +3 -0
  13. package/dist/cjs/api/types/UploadFileResponse.d.ts +6 -0
  14. package/dist/cjs/api/types/UploadFileResponse.js +3 -0
  15. package/dist/cjs/api/types/Workflow.d.ts +1 -0
  16. package/dist/cjs/api/types/index.d.ts +2 -0
  17. package/dist/cjs/api/types/index.js +2 -0
  18. package/dist/cjs/core/exports.d.ts +1 -0
  19. package/dist/cjs/core/exports.js +17 -0
  20. package/dist/cjs/core/file/exports.d.ts +1 -0
  21. package/dist/cjs/core/file/exports.js +2 -0
  22. package/dist/cjs/core/file/file.d.ts +10 -0
  23. package/dist/cjs/core/file/file.js +221 -0
  24. package/dist/cjs/core/file/index.d.ts +2 -0
  25. package/dist/cjs/core/file/index.js +18 -0
  26. package/dist/cjs/core/file/types.d.ts +66 -0
  27. package/dist/cjs/core/file/types.js +2 -0
  28. package/dist/cjs/core/form-data-utils/FormDataWrapper.d.ts +15 -0
  29. package/dist/cjs/core/form-data-utils/FormDataWrapper.js +185 -0
  30. package/dist/cjs/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
  31. package/dist/cjs/core/form-data-utils/encodeAsFormParameter.js +12 -0
  32. package/dist/cjs/core/form-data-utils/index.d.ts +2 -0
  33. package/dist/cjs/core/form-data-utils/index.js +20 -0
  34. package/dist/cjs/core/index.d.ts +2 -0
  35. package/dist/cjs/core/index.js +3 -1
  36. package/dist/cjs/exports.d.ts +1 -0
  37. package/dist/cjs/exports.js +17 -0
  38. package/dist/cjs/index.d.ts +1 -0
  39. package/dist/cjs/index.js +4 -0
  40. package/dist/cjs/library/Skyvern.js +21 -3
  41. package/dist/cjs/library/SkyvernBrowserPage.d.ts +85 -2
  42. package/dist/cjs/library/SkyvernBrowserPage.js +131 -18
  43. package/dist/cjs/library/SkyvernBrowserPageAgent.d.ts +68 -20
  44. package/dist/cjs/library/SkyvernBrowserPageAgent.js +20 -33
  45. package/dist/cjs/version.d.ts +1 -1
  46. package/dist/cjs/version.js +1 -1
  47. package/dist/esm/Client.d.mts +17 -1
  48. package/dist/esm/Client.mjs +80 -6
  49. package/dist/esm/api/client/requests/BodyUploadFileV1UploadFilePost.d.mts +10 -0
  50. package/dist/esm/api/client/requests/BodyUploadFileV1UploadFilePost.mjs +2 -0
  51. package/dist/esm/api/client/requests/GetWorkflowsRequest.d.mts +2 -0
  52. package/dist/esm/api/client/requests/index.d.mts +1 -0
  53. package/dist/esm/api/types/Action.d.mts +1 -0
  54. package/dist/esm/api/types/Artifact.d.mts +1 -0
  55. package/dist/esm/api/types/PromptAction.d.mts +1 -1
  56. package/dist/esm/api/types/RetryRunWebhookRequest.d.mts +4 -0
  57. package/dist/esm/api/types/RetryRunWebhookRequest.mjs +2 -0
  58. package/dist/esm/api/types/UploadFileResponse.d.mts +6 -0
  59. package/dist/esm/api/types/UploadFileResponse.mjs +2 -0
  60. package/dist/esm/api/types/Workflow.d.mts +1 -0
  61. package/dist/esm/api/types/index.d.mts +2 -0
  62. package/dist/esm/api/types/index.mjs +2 -0
  63. package/dist/esm/core/exports.d.mts +1 -0
  64. package/dist/esm/core/exports.mjs +1 -0
  65. package/dist/esm/core/file/exports.d.mts +1 -0
  66. package/dist/esm/core/file/exports.mjs +1 -0
  67. package/dist/esm/core/file/file.d.mts +10 -0
  68. package/dist/esm/core/file/file.mjs +184 -0
  69. package/dist/esm/core/file/index.d.mts +2 -0
  70. package/dist/esm/core/file/index.mjs +2 -0
  71. package/dist/esm/core/file/types.d.mts +66 -0
  72. package/dist/esm/core/file/types.mjs +1 -0
  73. package/dist/esm/core/form-data-utils/FormDataWrapper.d.mts +15 -0
  74. package/dist/esm/core/form-data-utils/FormDataWrapper.mjs +147 -0
  75. package/dist/esm/core/form-data-utils/encodeAsFormParameter.d.mts +1 -0
  76. package/dist/esm/core/form-data-utils/encodeAsFormParameter.mjs +9 -0
  77. package/dist/esm/core/form-data-utils/index.d.mts +2 -0
  78. package/dist/esm/core/form-data-utils/index.mjs +2 -0
  79. package/dist/esm/core/index.d.mts +2 -0
  80. package/dist/esm/core/index.mjs +2 -0
  81. package/dist/esm/exports.d.mts +1 -0
  82. package/dist/esm/exports.mjs +1 -0
  83. package/dist/esm/index.d.mts +1 -0
  84. package/dist/esm/index.mjs +1 -0
  85. package/dist/esm/library/Skyvern.mjs +21 -3
  86. package/dist/esm/library/SkyvernBrowserPage.d.mts +85 -2
  87. package/dist/esm/library/SkyvernBrowserPage.mjs +131 -18
  88. package/dist/esm/library/SkyvernBrowserPageAgent.d.mts +68 -20
  89. package/dist/esm/library/SkyvernBrowserPageAgent.mjs +20 -33
  90. package/dist/esm/version.d.mts +1 -1
  91. package/dist/esm/version.mjs +1 -1
  92. package/package.json +1 -1
package/README.md CHANGED
@@ -12,6 +12,7 @@ The Skyvern TypeScript library provides convenient access to the Skyvern APIs fr
12
12
  - [Usage](#usage)
13
13
  - [Request and Response Types](#request-and-response-types)
14
14
  - [Exception Handling](#exception-handling)
15
+ - [File Uploads](#file-uploads)
15
16
  - [Advanced](#advanced)
16
17
  - [Additional Headers](#additional-headers)
17
18
  - [Additional Query String Parameters](#additional-query-string-parameters)
@@ -81,6 +82,50 @@ try {
81
82
  }
82
83
  ```
83
84
 
85
+ ## File Uploads
86
+
87
+ You can upload files using the client:
88
+
89
+ ```typescript
90
+ import { createReadStream } from "fs";
91
+ import { SkyvernClient } from "@skyvern/client";
92
+ import * as fs from "fs";
93
+
94
+ const client = new SkyvernClient({ apiKey: "YOUR_API_KEY" });
95
+ await client.uploadFile({
96
+ file: fs.createReadStream("/path/to/your/file")
97
+ });
98
+ ```
99
+ The client accepts a variety of types for file upload parameters:
100
+ * Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream`
101
+ * Buffered types: `Buffer`, `Blob`, `File`, `ArrayBuffer`, `ArrayBufferView`, and `Uint8Array`
102
+
103
+ ### Metadata
104
+
105
+ You can configure metadata when uploading a file:
106
+ ```typescript
107
+ const file: Uploadable.WithMetadata = {
108
+ data: createReadStream("path/to/file"),
109
+ filename: "my-file", // optional
110
+ contentType: "audio/mpeg", // optional
111
+ contentLength: 1949, // optional
112
+ };
113
+ ```
114
+
115
+ Alternatively, you can upload a file directly from a file path:
116
+ ```typescript
117
+ const file : Uploadable.FromPath = {
118
+ path: "path/to/file",
119
+ filename: "my-file", // optional
120
+ contentType: "audio/mpeg", // optional
121
+ contentLength: 1949, // optional
122
+ };
123
+ ```
124
+
125
+ The metadata is used to set the `Content-Length`, `Content-Type`, and `Content-Disposition` headers. If not provided, the client will attempt to determine them automatically.
126
+ For example, `fs.ReadStream` has a `path` property which the SDK uses to retrieve the file size from the filesystem without loading it into memory.
127
+
128
+
84
129
  ## Advanced
85
130
 
86
131
  ### Additional Headers
@@ -101,6 +101,7 @@ export declare class SkyvernClient {
101
101
  * page_size: 1,
102
102
  * only_saved_tasks: true,
103
103
  * only_workflows: true,
104
+ * only_templates: true,
104
105
  * search_key: "search_key",
105
106
  * title: "title",
106
107
  * folder_id: "folder_id",
@@ -184,6 +185,7 @@ export declare class SkyvernClient {
184
185
  * Retry sending the webhook for a run
185
186
  *
186
187
  * @param {string} runId - The id of the task run or the workflow run.
188
+ * @param {Skyvern.RetryRunWebhookRequest} request
187
189
  * @param {SkyvernClient.RequestOptions} requestOptions - Request-specific configuration.
188
190
  *
189
191
  * @throws {@link Skyvern.UnprocessableEntityError}
@@ -191,7 +193,7 @@ export declare class SkyvernClient {
191
193
  * @example
192
194
  * await client.retryRunWebhook("tsk_123")
193
195
  */
194
- retryRunWebhook(runId: string, requestOptions?: SkyvernClient.RequestOptions): core.HttpResponsePromise<unknown>;
196
+ retryRunWebhook(runId: string, request?: Skyvern.RetryRunWebhookRequest, requestOptions?: SkyvernClient.RequestOptions): core.HttpResponsePromise<unknown>;
195
197
  private __retryRunWebhook;
196
198
  /**
197
199
  * Get timeline for a run (workflow run or task_v2 run)
@@ -208,6 +210,20 @@ export declare class SkyvernClient {
208
210
  */
209
211
  getRunTimeline(runId: string, requestOptions?: SkyvernClient.RequestOptions): core.HttpResponsePromise<Skyvern.WorkflowRunTimeline[]>;
210
212
  private __getRunTimeline;
213
+ /**
214
+ * @param {Skyvern.BodyUploadFileV1UploadFilePost} request
215
+ * @param {SkyvernClient.RequestOptions} requestOptions - Request-specific configuration.
216
+ *
217
+ * @throws {@link Skyvern.UnprocessableEntityError}
218
+ *
219
+ * @example
220
+ * import { createReadStream } from "fs";
221
+ * await client.uploadFile({
222
+ * file: fs.createReadStream("/path/to/your/file")
223
+ * })
224
+ */
225
+ uploadFile(request: Skyvern.BodyUploadFileV1UploadFilePost, requestOptions?: SkyvernClient.RequestOptions): core.HttpResponsePromise<Skyvern.UploadFileResponse>;
226
+ private __uploadFile;
211
227
  /**
212
228
  * Get all browser profiles for the organization
213
229
  *
@@ -56,8 +56,8 @@ class SkyvernClient {
56
56
  "x-api-key": _options === null || _options === void 0 ? void 0 : _options.apiKey,
57
57
  "X-Fern-Language": "JavaScript",
58
58
  "X-Fern-SDK-Name": "@skyvern/client",
59
- "X-Fern-SDK-Version": "1.0.3",
60
- "User-Agent": "@skyvern/client/1.0.3",
59
+ "X-Fern-SDK-Version": "1.0.6",
60
+ "User-Agent": "@skyvern/client/1.0.6",
61
61
  "X-Fern-Runtime": core.RUNTIME.type,
62
62
  "X-Fern-Runtime-Version": core.RUNTIME.version,
63
63
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -363,6 +363,7 @@ class SkyvernClient {
363
363
  * page_size: 1,
364
364
  * only_saved_tasks: true,
365
365
  * only_workflows: true,
366
+ * only_templates: true,
366
367
  * search_key: "search_key",
367
368
  * title: "title",
368
369
  * folder_id: "folder_id",
@@ -375,7 +376,7 @@ class SkyvernClient {
375
376
  __getWorkflows() {
376
377
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
377
378
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
378
- const { page, page_size: pageSize, only_saved_tasks: onlySavedTasks, only_workflows: onlyWorkflows, search_key: searchKey, title, folder_id: folderId, status, template, } = request;
379
+ const { page, page_size: pageSize, only_saved_tasks: onlySavedTasks, only_workflows: onlyWorkflows, only_templates: onlyTemplates, search_key: searchKey, title, folder_id: folderId, status, template, } = request;
379
380
  const _queryParams = {};
380
381
  if (page != null) {
381
382
  _queryParams.page = page.toString();
@@ -389,6 +390,9 @@ class SkyvernClient {
389
390
  if (onlyWorkflows != null) {
390
391
  _queryParams.only_workflows = onlyWorkflows.toString();
391
392
  }
393
+ if (onlyTemplates != null) {
394
+ _queryParams.only_templates = onlyTemplates.toString();
395
+ }
392
396
  if (searchKey != null) {
393
397
  _queryParams.search_key = searchKey;
394
398
  }
@@ -779,6 +783,7 @@ class SkyvernClient {
779
783
  * Retry sending the webhook for a run
780
784
  *
781
785
  * @param {string} runId - The id of the task run or the workflow run.
786
+ * @param {Skyvern.RetryRunWebhookRequest} request
782
787
  * @param {SkyvernClient.RequestOptions} requestOptions - Request-specific configuration.
783
788
  *
784
789
  * @throws {@link Skyvern.UnprocessableEntityError}
@@ -786,10 +791,10 @@ class SkyvernClient {
786
791
  * @example
787
792
  * await client.retryRunWebhook("tsk_123")
788
793
  */
789
- retryRunWebhook(runId, requestOptions) {
790
- return core.HttpResponsePromise.fromPromise(this.__retryRunWebhook(runId, requestOptions));
794
+ retryRunWebhook(runId, request, requestOptions) {
795
+ return core.HttpResponsePromise.fromPromise(this.__retryRunWebhook(runId, request, requestOptions));
791
796
  }
792
- __retryRunWebhook(runId, requestOptions) {
797
+ __retryRunWebhook(runId, request, requestOptions) {
793
798
  return __awaiter(this, void 0, void 0, function* () {
794
799
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
795
800
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
@@ -797,7 +802,10 @@ class SkyvernClient {
797
802
  url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.SkyvernEnvironment.Cloud, `v1/runs/${core.url.encodePathParam(runId)}/retry_webhook`),
798
803
  method: "POST",
799
804
  headers: _headers,
805
+ contentType: "application/json",
800
806
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
807
+ requestType: "json",
808
+ body: request != null ? request : undefined,
801
809
  timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
802
810
  maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
803
811
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -899,6 +907,72 @@ class SkyvernClient {
899
907
  }
900
908
  });
901
909
  }
910
+ /**
911
+ * @param {Skyvern.BodyUploadFileV1UploadFilePost} request
912
+ * @param {SkyvernClient.RequestOptions} requestOptions - Request-specific configuration.
913
+ *
914
+ * @throws {@link Skyvern.UnprocessableEntityError}
915
+ *
916
+ * @example
917
+ * import { createReadStream } from "fs";
918
+ * await client.uploadFile({
919
+ * file: fs.createReadStream("/path/to/your/file")
920
+ * })
921
+ */
922
+ uploadFile(request, requestOptions) {
923
+ return core.HttpResponsePromise.fromPromise(this.__uploadFile(request, requestOptions));
924
+ }
925
+ __uploadFile(request, requestOptions) {
926
+ return __awaiter(this, void 0, void 0, function* () {
927
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
928
+ const _request = yield core.newFormData();
929
+ yield _request.appendFile("file", request.file);
930
+ const _maybeEncodedRequest = yield _request.getRequest();
931
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
932
+ const _response = yield core.fetcher({
933
+ url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.SkyvernEnvironment.Cloud, "v1/upload_file"),
934
+ method: "POST",
935
+ headers: _headers,
936
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
937
+ requestType: "file",
938
+ duplex: _maybeEncodedRequest.duplex,
939
+ body: _maybeEncodedRequest.body,
940
+ timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
941
+ maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
942
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
943
+ });
944
+ if (_response.ok) {
945
+ return { data: _response.body, rawResponse: _response.rawResponse };
946
+ }
947
+ if (_response.error.reason === "status-code") {
948
+ switch (_response.error.statusCode) {
949
+ case 422:
950
+ throw new Skyvern.UnprocessableEntityError(_response.error.body, _response.rawResponse);
951
+ default:
952
+ throw new errors.SkyvernError({
953
+ statusCode: _response.error.statusCode,
954
+ body: _response.error.body,
955
+ rawResponse: _response.rawResponse,
956
+ });
957
+ }
958
+ }
959
+ switch (_response.error.reason) {
960
+ case "non-json":
961
+ throw new errors.SkyvernError({
962
+ statusCode: _response.error.statusCode,
963
+ body: _response.error.rawBody,
964
+ rawResponse: _response.rawResponse,
965
+ });
966
+ case "timeout":
967
+ throw new errors.SkyvernTimeoutError("Timeout exceeded when calling POST /v1/upload_file.");
968
+ case "unknown":
969
+ throw new errors.SkyvernError({
970
+ message: _response.error.errorMessage,
971
+ rawResponse: _response.rawResponse,
972
+ });
973
+ }
974
+ });
975
+ }
902
976
  /**
903
977
  * Get all browser profiles for the organization
904
978
  *
@@ -0,0 +1,10 @@
1
+ import type * as core from "../../../core/index.js";
2
+ /**
3
+ * @example
4
+ * {
5
+ * file: fs.createReadStream("/path/to/your/file")
6
+ * }
7
+ */
8
+ export interface BodyUploadFileV1UploadFilePost {
9
+ file: core.file.Uploadable;
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,6 +6,7 @@ import type * as Skyvern from "../../index.js";
6
6
  * page_size: 1,
7
7
  * only_saved_tasks: true,
8
8
  * only_workflows: true,
9
+ * only_templates: true,
9
10
  * search_key: "search_key",
10
11
  * title: "title",
11
12
  * folder_id: "folder_id",
@@ -17,6 +18,7 @@ export interface GetWorkflowsRequest {
17
18
  page_size?: number;
18
19
  only_saved_tasks?: boolean;
19
20
  only_workflows?: boolean;
21
+ only_templates?: boolean;
20
22
  /** Unified search across workflow title, folder name, and parameter metadata (key, description, default_value). */
21
23
  search_key?: string;
22
24
  /** Deprecated: use search_key instead. */
@@ -1,3 +1,4 @@
1
+ export type { BodyUploadFileV1UploadFilePost } from "./BodyUploadFileV1UploadFilePost.js";
1
2
  export type { CreateBrowserProfileRequest } from "./CreateBrowserProfileRequest.js";
2
3
  export type { CreateBrowserSessionRequest } from "./CreateBrowserSessionRequest.js";
3
4
  export type { CreateCredentialRequest } from "./CreateCredentialRequest.js";
@@ -33,6 +33,7 @@ export interface Action {
33
33
  verified?: boolean;
34
34
  click_context?: Skyvern.ClickContext;
35
35
  totp_timing_info?: Record<string, unknown>;
36
+ has_mini_agent?: boolean;
36
37
  created_at?: string;
37
38
  modified_at?: string;
38
39
  created_by?: string;
@@ -11,6 +11,7 @@ export interface Artifact {
11
11
  step_id?: string;
12
12
  workflow_run_id?: string;
13
13
  workflow_run_block_id?: string;
14
+ run_id?: string;
14
15
  observer_cruise_id?: string;
15
16
  observer_thought_id?: string;
16
17
  ai_suggestion_id?: string;
@@ -5,7 +5,7 @@ export interface PromptAction {
5
5
  /** The prompt to send to the LLM */
6
6
  prompt: string;
7
7
  /** Optional JSON schema to structure the response */
8
- schema?: Record<string, unknown>;
8
+ response_schema?: Record<string, unknown>;
9
9
  /** Optional model configuration */
10
10
  model?: Record<string, unknown>;
11
11
  }
@@ -0,0 +1,4 @@
1
+ export interface RetryRunWebhookRequest {
2
+ /** Optional webhook URL to send the payload to instead of the stored configuration */
3
+ webhook_url?: string;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export interface UploadFileResponse {
2
+ /** S3 URI where the file was uploaded */
3
+ s3_uri: string;
4
+ /** Presigned URL to access the uploaded file */
5
+ presigned_url: string;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,6 +6,7 @@ export interface Workflow {
6
6
  workflow_permanent_id: string;
7
7
  version: number;
8
8
  is_saved_task: boolean;
9
+ is_template?: boolean;
9
10
  description?: string;
10
11
  workflow_definition: Skyvern.WorkflowDefinition;
11
12
  proxy_location?: Workflow.ProxyLocation;
@@ -96,6 +96,7 @@ export * from "./PdfParserBlockYaml.js";
96
96
  export * from "./PromptAction.js";
97
97
  export * from "./PromptBranchCriteria.js";
98
98
  export * from "./ProxyLocation.js";
99
+ export * from "./RetryRunWebhookRequest.js";
99
100
  export * from "./RunEngine.js";
100
101
  export * from "./RunSdkActionRequestAction.js";
101
102
  export * from "./RunSdkActionResponse.js";
@@ -127,6 +128,7 @@ export * from "./ThoughtType.js";
127
128
  export * from "./TotpCode.js";
128
129
  export * from "./TotpType.js";
129
130
  export * from "./UploadFileAction.js";
131
+ export * from "./UploadFileResponse.js";
130
132
  export * from "./UploadToS3Block.js";
131
133
  export * from "./UploadToS3BlockYaml.js";
132
134
  export * from "./UrlBlock.js";
@@ -112,6 +112,7 @@ __exportStar(require("./PdfParserBlockYaml.js"), exports);
112
112
  __exportStar(require("./PromptAction.js"), exports);
113
113
  __exportStar(require("./PromptBranchCriteria.js"), exports);
114
114
  __exportStar(require("./ProxyLocation.js"), exports);
115
+ __exportStar(require("./RetryRunWebhookRequest.js"), exports);
115
116
  __exportStar(require("./RunEngine.js"), exports);
116
117
  __exportStar(require("./RunSdkActionRequestAction.js"), exports);
117
118
  __exportStar(require("./RunSdkActionResponse.js"), exports);
@@ -143,6 +144,7 @@ __exportStar(require("./ThoughtType.js"), exports);
143
144
  __exportStar(require("./TotpCode.js"), exports);
144
145
  __exportStar(require("./TotpType.js"), exports);
145
146
  __exportStar(require("./UploadFileAction.js"), exports);
147
+ __exportStar(require("./UploadFileResponse.js"), exports);
146
148
  __exportStar(require("./UploadToS3Block.js"), exports);
147
149
  __exportStar(require("./UploadToS3BlockYaml.js"), exports);
148
150
  __exportStar(require("./UrlBlock.js"), exports);
@@ -0,0 +1 @@
1
+ export * from "./file/exports.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./file/exports.js"), exports);
@@ -0,0 +1 @@
1
+ export type { Uploadable } from "./types.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import type { Uploadable } from "./types.js";
2
+ export declare function toBinaryUploadRequest(file: Uploadable): Promise<{
3
+ body: Uploadable.FileLike;
4
+ headers?: Record<string, string>;
5
+ }>;
6
+ export declare function toMultipartDataPart(file: Uploadable): Promise<{
7
+ data: Uploadable.FileLike;
8
+ filename?: string;
9
+ contentType?: string;
10
+ }>;
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.toBinaryUploadRequest = toBinaryUploadRequest;
46
+ exports.toMultipartDataPart = toMultipartDataPart;
47
+ function toBinaryUploadRequest(file) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ const { data, filename, contentLength, contentType } = yield getFileWithMetadata(file);
50
+ const request = {
51
+ body: data,
52
+ headers: {},
53
+ };
54
+ if (filename) {
55
+ request.headers["Content-Disposition"] = `attachment; filename="${filename}"`;
56
+ }
57
+ if (contentType) {
58
+ request.headers["Content-Type"] = contentType;
59
+ }
60
+ if (contentLength != null) {
61
+ request.headers["Content-Length"] = contentLength.toString();
62
+ }
63
+ return request;
64
+ });
65
+ }
66
+ function toMultipartDataPart(file) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ const { data, filename, contentType } = yield getFileWithMetadata(file, {
69
+ noSniffFileSize: true,
70
+ });
71
+ return {
72
+ data,
73
+ filename,
74
+ contentType,
75
+ };
76
+ });
77
+ }
78
+ function getFileWithMetadata(file_1) {
79
+ return __awaiter(this, arguments, void 0, function* (file, { noSniffFileSize } = {}) {
80
+ var _a, _b, _c, _d, _e;
81
+ if (isFileLike(file)) {
82
+ return getFileWithMetadata({
83
+ data: file,
84
+ }, { noSniffFileSize });
85
+ }
86
+ if ("path" in file) {
87
+ const fs = yield Promise.resolve().then(() => __importStar(require("fs")));
88
+ if (!fs || !fs.createReadStream) {
89
+ throw new Error("File path uploads are not supported in this environment.");
90
+ }
91
+ const data = fs.createReadStream(file.path);
92
+ const contentLength = (_a = file.contentLength) !== null && _a !== void 0 ? _a : (noSniffFileSize === true ? undefined : yield tryGetFileSizeFromPath(file.path));
93
+ const filename = (_b = file.filename) !== null && _b !== void 0 ? _b : getNameFromPath(file.path);
94
+ return {
95
+ data,
96
+ filename,
97
+ contentType: file.contentType,
98
+ contentLength,
99
+ };
100
+ }
101
+ if ("data" in file) {
102
+ const data = file.data;
103
+ const contentLength = (_c = file.contentLength) !== null && _c !== void 0 ? _c : (yield tryGetContentLengthFromFileLike(data, {
104
+ noSniffFileSize,
105
+ }));
106
+ const filename = (_d = file.filename) !== null && _d !== void 0 ? _d : tryGetNameFromFileLike(data);
107
+ return {
108
+ data,
109
+ filename,
110
+ contentType: (_e = file.contentType) !== null && _e !== void 0 ? _e : tryGetContentTypeFromFileLike(data),
111
+ contentLength,
112
+ };
113
+ }
114
+ throw new Error(`Invalid FileUpload of type ${typeof file}: ${JSON.stringify(file)}`);
115
+ });
116
+ }
117
+ function isFileLike(value) {
118
+ return (isBuffer(value) ||
119
+ isArrayBufferView(value) ||
120
+ isArrayBuffer(value) ||
121
+ isUint8Array(value) ||
122
+ isBlob(value) ||
123
+ isFile(value) ||
124
+ isStreamLike(value) ||
125
+ isReadableStream(value));
126
+ }
127
+ function tryGetFileSizeFromPath(path) {
128
+ return __awaiter(this, void 0, void 0, function* () {
129
+ try {
130
+ const fs = yield Promise.resolve().then(() => __importStar(require("fs")));
131
+ if (!fs || !fs.promises || !fs.promises.stat) {
132
+ return undefined;
133
+ }
134
+ const fileStat = yield fs.promises.stat(path);
135
+ return fileStat.size;
136
+ }
137
+ catch (_fallbackError) {
138
+ return undefined;
139
+ }
140
+ });
141
+ }
142
+ function tryGetNameFromFileLike(data) {
143
+ if (isNamedValue(data)) {
144
+ return data.name;
145
+ }
146
+ if (isPathedValue(data)) {
147
+ return getNameFromPath(data.path.toString());
148
+ }
149
+ return undefined;
150
+ }
151
+ function tryGetContentLengthFromFileLike(data_1) {
152
+ return __awaiter(this, arguments, void 0, function* (data, { noSniffFileSize } = {}) {
153
+ if (isBuffer(data)) {
154
+ return data.length;
155
+ }
156
+ if (isArrayBufferView(data)) {
157
+ return data.byteLength;
158
+ }
159
+ if (isArrayBuffer(data)) {
160
+ return data.byteLength;
161
+ }
162
+ if (isBlob(data)) {
163
+ return data.size;
164
+ }
165
+ if (isFile(data)) {
166
+ return data.size;
167
+ }
168
+ if (noSniffFileSize === true) {
169
+ return undefined;
170
+ }
171
+ if (isPathedValue(data)) {
172
+ return yield tryGetFileSizeFromPath(data.path.toString());
173
+ }
174
+ return undefined;
175
+ });
176
+ }
177
+ function tryGetContentTypeFromFileLike(data) {
178
+ if (isBlob(data)) {
179
+ return data.type;
180
+ }
181
+ if (isFile(data)) {
182
+ return data.type;
183
+ }
184
+ return undefined;
185
+ }
186
+ function getNameFromPath(path) {
187
+ const lastForwardSlash = path.lastIndexOf("/");
188
+ const lastBackSlash = path.lastIndexOf("\\");
189
+ const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash);
190
+ return lastSlashIndex >= 0 ? path.substring(lastSlashIndex + 1) : path;
191
+ }
192
+ function isNamedValue(value) {
193
+ return typeof value === "object" && value != null && "name" in value;
194
+ }
195
+ function isPathedValue(value) {
196
+ return typeof value === "object" && value != null && "path" in value;
197
+ }
198
+ function isStreamLike(value) {
199
+ return typeof value === "object" && value != null && ("read" in value || "pipe" in value);
200
+ }
201
+ function isReadableStream(value) {
202
+ return typeof value === "object" && value != null && "getReader" in value;
203
+ }
204
+ function isBuffer(value) {
205
+ return typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(value);
206
+ }
207
+ function isArrayBufferView(value) {
208
+ return typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(value);
209
+ }
210
+ function isArrayBuffer(value) {
211
+ return typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer;
212
+ }
213
+ function isUint8Array(value) {
214
+ return typeof Uint8Array !== "undefined" && value instanceof Uint8Array;
215
+ }
216
+ function isBlob(value) {
217
+ return typeof Blob !== "undefined" && value instanceof Blob;
218
+ }
219
+ function isFile(value) {
220
+ return typeof File !== "undefined" && value instanceof File;
221
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./file.js";
2
+ export * from "./types.js";