@airtop/sdk 0.1.41-beta0 → 0.1.42-beta0

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 (90) hide show
  1. package/api/resources/automations/client/Client.js +4 -4
  2. package/api/resources/files/client/Client.js +5 -5
  3. package/api/resources/files/client/requests/CreateFileRestInputV1.d.ts +1 -1
  4. package/api/resources/profiles/client/Client.js +1 -1
  5. package/api/resources/requests/client/Client.js +1 -1
  6. package/api/resources/sessions/client/Client.js +6 -6
  7. package/api/resources/windows/client/Client.d.ts +23 -9
  8. package/api/resources/windows/client/Client.js +106 -49
  9. package/api/resources/windows/client/requests/AsyncFileInputRequest.d.ts +4 -4
  10. package/api/resources/windows/client/requests/SessionFileInputHandlerRequestBody.d.ts +4 -4
  11. package/api/resources/windows/client/requests/WaitForPageRequest.d.ts +23 -0
  12. package/api/resources/windows/client/requests/WaitForPageRequest.js +5 -0
  13. package/api/resources/windows/client/requests/index.d.ts +1 -0
  14. package/api/resources/windows/types/WaitForPageRequestTargetStatus.d.ts +11 -0
  15. package/api/resources/windows/types/WaitForPageRequestTargetStatus.js +10 -0
  16. package/api/resources/windows/types/index.d.ts +1 -0
  17. package/api/resources/windows/types/index.js +1 -0
  18. package/api/types/FileEventData.d.ts +7 -0
  19. package/api/types/FileEventData.js +5 -0
  20. package/api/types/FileEventMessage.d.ts +2 -1
  21. package/api/types/index.d.ts +1 -0
  22. package/api/types/index.js +1 -0
  23. package/dist/api/resources/automations/client/Client.js +4 -4
  24. package/dist/api/resources/files/client/Client.js +5 -5
  25. package/dist/api/resources/files/client/requests/CreateFileRestInputV1.d.ts +1 -1
  26. package/dist/api/resources/profiles/client/Client.js +1 -1
  27. package/dist/api/resources/requests/client/Client.js +1 -1
  28. package/dist/api/resources/sessions/client/Client.js +6 -6
  29. package/dist/api/resources/windows/client/Client.d.ts +23 -9
  30. package/dist/api/resources/windows/client/Client.js +106 -49
  31. package/dist/api/resources/windows/client/requests/AsyncFileInputRequest.d.ts +4 -4
  32. package/dist/api/resources/windows/client/requests/SessionFileInputHandlerRequestBody.d.ts +4 -4
  33. package/dist/api/resources/windows/client/requests/WaitForPageRequest.d.ts +23 -0
  34. package/dist/api/resources/windows/client/requests/WaitForPageRequest.js +5 -0
  35. package/dist/api/resources/windows/client/requests/index.d.ts +1 -0
  36. package/dist/api/resources/windows/types/WaitForPageRequestTargetStatus.d.ts +11 -0
  37. package/dist/api/resources/windows/types/WaitForPageRequestTargetStatus.js +10 -0
  38. package/dist/api/resources/windows/types/index.d.ts +1 -0
  39. package/dist/api/resources/windows/types/index.js +1 -0
  40. package/dist/api/types/FileEventData.d.ts +7 -0
  41. package/dist/api/types/FileEventData.js +5 -0
  42. package/dist/api/types/FileEventMessage.d.ts +2 -1
  43. package/dist/api/types/index.d.ts +1 -0
  44. package/dist/api/types/index.js +1 -0
  45. package/dist/serialization/resources/windows/client/requests/AsyncFileInputRequest.d.ts +2 -1
  46. package/dist/serialization/resources/windows/client/requests/AsyncFileInputRequest.js +2 -1
  47. package/dist/serialization/resources/windows/client/requests/SessionFileInputHandlerRequestBody.d.ts +2 -1
  48. package/dist/serialization/resources/windows/client/requests/SessionFileInputHandlerRequestBody.js +2 -1
  49. package/dist/serialization/resources/windows/client/requests/WaitForPageRequest.d.ts +18 -0
  50. package/dist/serialization/resources/windows/client/requests/WaitForPageRequest.js +49 -0
  51. package/dist/serialization/resources/windows/client/requests/index.d.ts +1 -0
  52. package/dist/serialization/resources/windows/client/requests/index.js +3 -1
  53. package/dist/serialization/resources/windows/types/WaitForPageRequestTargetStatus.d.ts +10 -0
  54. package/dist/serialization/resources/windows/types/WaitForPageRequestTargetStatus.js +41 -0
  55. package/dist/serialization/resources/windows/types/index.d.ts +1 -0
  56. package/dist/serialization/resources/windows/types/index.js +1 -0
  57. package/dist/serialization/types/FileEventData.d.ts +13 -0
  58. package/dist/serialization/types/FileEventData.js +44 -0
  59. package/dist/serialization/types/FileEventMessage.d.ts +2 -1
  60. package/dist/serialization/types/FileEventMessage.js +2 -1
  61. package/dist/serialization/types/index.d.ts +1 -0
  62. package/dist/serialization/types/index.js +1 -0
  63. package/dist/utils/upload.js +12 -7
  64. package/dist/version.d.ts +1 -1
  65. package/dist/version.js +1 -1
  66. package/dist/wrapper/AirtopSessions.js +12 -5
  67. package/package.json +1 -1
  68. package/reference.md +88 -7
  69. package/serialization/resources/windows/client/requests/AsyncFileInputRequest.d.ts +2 -1
  70. package/serialization/resources/windows/client/requests/AsyncFileInputRequest.js +2 -1
  71. package/serialization/resources/windows/client/requests/SessionFileInputHandlerRequestBody.d.ts +2 -1
  72. package/serialization/resources/windows/client/requests/SessionFileInputHandlerRequestBody.js +2 -1
  73. package/serialization/resources/windows/client/requests/WaitForPageRequest.d.ts +18 -0
  74. package/serialization/resources/windows/client/requests/WaitForPageRequest.js +49 -0
  75. package/serialization/resources/windows/client/requests/index.d.ts +1 -0
  76. package/serialization/resources/windows/client/requests/index.js +3 -1
  77. package/serialization/resources/windows/types/WaitForPageRequestTargetStatus.d.ts +10 -0
  78. package/serialization/resources/windows/types/WaitForPageRequestTargetStatus.js +41 -0
  79. package/serialization/resources/windows/types/index.d.ts +1 -0
  80. package/serialization/resources/windows/types/index.js +1 -0
  81. package/serialization/types/FileEventData.d.ts +13 -0
  82. package/serialization/types/FileEventData.js +44 -0
  83. package/serialization/types/FileEventMessage.d.ts +2 -1
  84. package/serialization/types/FileEventMessage.js +2 -1
  85. package/serialization/types/index.d.ts +1 -0
  86. package/serialization/types/index.js +1 -0
  87. package/utils/upload.js +12 -7
  88. package/version.d.ts +1 -1
  89. package/version.js +1 -1
  90. package/wrapper/AirtopSessions.js +12 -5
package/reference.md CHANGED
@@ -360,9 +360,7 @@ Execute a file input interaction in a specific browser window asynchronously
360
360
  <dd>
361
361
 
362
362
  ```typescript
363
- await client.windows.asyncFileInput("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
364
- elementDescription: "The file input in the bottom left corner",
365
- });
363
+ await client.windows.asyncFileInput("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430");
366
364
  ```
367
365
 
368
366
  </dd>
@@ -1550,7 +1548,13 @@ await client.windows.createFormFiller("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0
1550
1548
  <dl>
1551
1549
  <dd>
1552
1550
 
1553
- Execute a file input interaction in a specific browser window
1551
+ Execute a file input interaction in a specific browser window.
1552
+ includeHiddenElements defaults to true and considers hidden file input elements.
1553
+ If there is only one file input element, it will be used directly.
1554
+ If there are multiple file input elements, the elementDescription will be used by AI to
1555
+ select among them.
1556
+ If no file input elements are found by inspecting the page structure, elementDescription
1557
+ will be used by AI to try to find a match visually.
1554
1558
 
1555
1559
  </dd>
1556
1560
  </dl>
@@ -1566,9 +1570,7 @@ Execute a file input interaction in a specific browser window
1566
1570
  <dd>
1567
1571
 
1568
1572
  ```typescript
1569
- await client.windows.fileInput("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
1570
- elementDescription: "The file input in the bottom left corner",
1571
- });
1573
+ await client.windows.fileInput("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430");
1572
1574
  ```
1573
1575
 
1574
1576
  </dd>
@@ -2981,6 +2983,85 @@ await client.windows.llm("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-
2981
2983
  </dl>
2982
2984
  </details>
2983
2985
 
2986
+ <details><summary><code>client.windows.<a href="/src/api/resources/windows/client/Client.ts">waitForPage</a>(sessionId, windowId, { ...params }) -> Airtop.AsyncSessionAiResponseEnvelope</code></summary>
2987
+ <dl>
2988
+ <dd>
2989
+
2990
+ #### 📝 Description
2991
+
2992
+ <dl>
2993
+ <dd>
2994
+
2995
+ <dl>
2996
+ <dd>
2997
+
2998
+ Wait for a page to load
2999
+
3000
+ </dd>
3001
+ </dl>
3002
+ </dd>
3003
+ </dl>
3004
+
3005
+ #### 🔌 Usage
3006
+
3007
+ <dl>
3008
+ <dd>
3009
+
3010
+ <dl>
3011
+ <dd>
3012
+
3013
+ ```typescript
3014
+ await client.windows.waitForPage("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430");
3015
+ ```
3016
+
3017
+ </dd>
3018
+ </dl>
3019
+ </dd>
3020
+ </dl>
3021
+
3022
+ #### ⚙️ Parameters
3023
+
3024
+ <dl>
3025
+ <dd>
3026
+
3027
+ <dl>
3028
+ <dd>
3029
+
3030
+ **sessionId:** `string` — The session id for the window.
3031
+
3032
+ </dd>
3033
+ </dl>
3034
+
3035
+ <dl>
3036
+ <dd>
3037
+
3038
+ **windowId:** `string` — The Airtop window id of the browser window.
3039
+
3040
+ </dd>
3041
+ </dl>
3042
+
3043
+ <dl>
3044
+ <dd>
3045
+
3046
+ **request:** `Airtop.WaitForPageRequest`
3047
+
3048
+ </dd>
3049
+ </dl>
3050
+
3051
+ <dl>
3052
+ <dd>
3053
+
3054
+ **requestOptions:** `Windows.RequestOptions`
3055
+
3056
+ </dd>
3057
+ </dl>
3058
+ </dd>
3059
+ </dl>
3060
+
3061
+ </dd>
3062
+ </dl>
3063
+ </details>
3064
+
2984
3065
  ## Automations
2985
3066
 
2986
3067
  <details><summary><code>client.automations.<a href="/src/api/resources/automations/client/Client.ts">list</a>() -> Airtop.ListAutomationsOutput</code></summary>
@@ -13,9 +13,10 @@ export declare namespace AsyncFileInputRequest {
13
13
  clientRequestId?: string | null;
14
14
  configuration?: MicroInteractionConfigWithExperimental.Raw | null;
15
15
  costThresholdCredits?: number | null;
16
- elementDescription: string;
16
+ elementDescription?: string | null;
17
17
  fileId?: string | null;
18
18
  fileName?: string | null;
19
+ includeHiddenElements?: boolean | null;
19
20
  timeThresholdSeconds?: number | null;
20
21
  waitForNavigation?: boolean | null;
21
22
  }
@@ -45,9 +45,10 @@ exports.AsyncFileInputRequest = core.serialization.object({
45
45
  clientRequestId: core.serialization.string().optional(),
46
46
  configuration: MicroInteractionConfigWithExperimental_1.MicroInteractionConfigWithExperimental.optional(),
47
47
  costThresholdCredits: core.serialization.number().optional(),
48
- elementDescription: core.serialization.string(),
48
+ elementDescription: core.serialization.string().optional(),
49
49
  fileId: core.serialization.string().optional(),
50
50
  fileName: core.serialization.string().optional(),
51
+ includeHiddenElements: core.serialization.boolean().optional(),
51
52
  timeThresholdSeconds: core.serialization.number().optional(),
52
53
  waitForNavigation: core.serialization.boolean().optional(),
53
54
  });
@@ -11,9 +11,10 @@ export declare namespace SessionFileInputHandlerRequestBody {
11
11
  clientRequestId?: string | null;
12
12
  configuration?: MicroInteractionConfigWithExperimental.Raw | null;
13
13
  costThresholdCredits?: number | null;
14
- elementDescription: string;
14
+ elementDescription?: string | null;
15
15
  fileId?: string | null;
16
16
  fileName?: string | null;
17
+ includeHiddenElements?: boolean | null;
17
18
  timeThresholdSeconds?: number | null;
18
19
  waitForNavigation?: boolean | null;
19
20
  }
@@ -43,9 +43,10 @@ exports.SessionFileInputHandlerRequestBody = core.serialization.object({
43
43
  clientRequestId: core.serialization.string().optional(),
44
44
  configuration: MicroInteractionConfigWithExperimental_1.MicroInteractionConfigWithExperimental.optional(),
45
45
  costThresholdCredits: core.serialization.number().optional(),
46
- elementDescription: core.serialization.string(),
46
+ elementDescription: core.serialization.string().optional(),
47
47
  fileId: core.serialization.string().optional(),
48
48
  fileName: core.serialization.string().optional(),
49
+ includeHiddenElements: core.serialization.boolean().optional(),
49
50
  timeThresholdSeconds: core.serialization.number().optional(),
50
51
  waitForNavigation: core.serialization.boolean().optional(),
51
52
  });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../../../../index";
5
+ import * as Airtop from "../../../../../api/index";
6
+ import * as core from "../../../../../core";
7
+ import { AsyncConfig } from "../../../../types/AsyncConfig";
8
+ import { WaitForPageRequestTargetStatus } from "../../types/WaitForPageRequestTargetStatus";
9
+ export declare const WaitForPageRequest: core.serialization.Schema<serializers.WaitForPageRequest.Raw, Airtop.WaitForPageRequest>;
10
+ export declare namespace WaitForPageRequest {
11
+ interface Raw {
12
+ async?: AsyncConfig.Raw | null;
13
+ clientRequestId?: string | null;
14
+ costThresholdCredits?: number | null;
15
+ targetStatus?: WaitForPageRequestTargetStatus.Raw | null;
16
+ timeThresholdSeconds?: number | null;
17
+ }
18
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.WaitForPageRequest = void 0;
40
+ const core = __importStar(require("../../../../../core"));
41
+ const AsyncConfig_1 = require("../../../../types/AsyncConfig");
42
+ const WaitForPageRequestTargetStatus_1 = require("../../types/WaitForPageRequestTargetStatus");
43
+ exports.WaitForPageRequest = core.serialization.object({
44
+ async: AsyncConfig_1.AsyncConfig.optional(),
45
+ clientRequestId: core.serialization.string().optional(),
46
+ costThresholdCredits: core.serialization.number().optional(),
47
+ targetStatus: WaitForPageRequestTargetStatus_1.WaitForPageRequestTargetStatus.optional(),
48
+ timeThresholdSeconds: core.serialization.number().optional(),
49
+ });
@@ -32,3 +32,4 @@ export { ExtractRequest } from "./ExtractRequest";
32
32
  export { FindManyRequest } from "./FindManyRequest";
33
33
  export { FindOneRequest } from "./FindOneRequest";
34
34
  export { LlmRequest } from "./LlmRequest";
35
+ export { WaitForPageRequest } from "./WaitForPageRequest";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LlmRequest = exports.FindOneRequest = exports.FindManyRequest = exports.ExtractRequest = exports.ActRequest = exports.SessionTypeHandlerRequestBody = exports.SessionSummaryHandlerRequestBody = exports.SessionScrollHandlerRequestBody = exports.SessionScreenshotHandlerRequestBody = exports.ScrapeContentRequest = exports.SessionPaginatedExtractionHandlerRequestBody = exports.OperatorPromptV1Body = exports.SessionMonitorHandlerRequestBody = exports.SessionHoverHandlerRequestBody = exports.FillFormRequest = exports.SessionFileInputHandlerRequestBody = exports.CreateFormFillerRequest = exports.SessionClickHandlerRequestBody = exports.WindowLoadUrlV1Body = exports.CreateWindowInputV1Body = exports.AsyncTypeRequest = exports.AsyncSummarizeContentRequest = exports.AsyncScreenshotRequest = exports.AsyncPromptContentRequest = exports.AsyncPaginatedExtractionRequest = exports.AsyncPageQueryRequest = exports.AsyncMonitorRequest = exports.AsyncHoverRequest = exports.AsyncFillFormRequest = exports.AsyncFileInputRequest = exports.AsyncExecuteAutomationRequest = exports.AsyncCreateFormFillerRequest = exports.AsyncCreateAutomationRequest = exports.AsyncClickRequest = void 0;
3
+ exports.WaitForPageRequest = exports.LlmRequest = exports.FindOneRequest = exports.FindManyRequest = exports.ExtractRequest = exports.ActRequest = exports.SessionTypeHandlerRequestBody = exports.SessionSummaryHandlerRequestBody = exports.SessionScrollHandlerRequestBody = exports.SessionScreenshotHandlerRequestBody = exports.ScrapeContentRequest = exports.SessionPaginatedExtractionHandlerRequestBody = exports.OperatorPromptV1Body = exports.SessionMonitorHandlerRequestBody = exports.SessionHoverHandlerRequestBody = exports.FillFormRequest = exports.SessionFileInputHandlerRequestBody = exports.CreateFormFillerRequest = exports.SessionClickHandlerRequestBody = exports.WindowLoadUrlV1Body = exports.CreateWindowInputV1Body = exports.AsyncTypeRequest = exports.AsyncSummarizeContentRequest = exports.AsyncScreenshotRequest = exports.AsyncPromptContentRequest = exports.AsyncPaginatedExtractionRequest = exports.AsyncPageQueryRequest = exports.AsyncMonitorRequest = exports.AsyncHoverRequest = exports.AsyncFillFormRequest = exports.AsyncFileInputRequest = exports.AsyncExecuteAutomationRequest = exports.AsyncCreateFormFillerRequest = exports.AsyncCreateAutomationRequest = exports.AsyncClickRequest = void 0;
4
4
  var AsyncClickRequest_1 = require("./AsyncClickRequest");
5
5
  Object.defineProperty(exports, "AsyncClickRequest", { enumerable: true, get: function () { return AsyncClickRequest_1.AsyncClickRequest; } });
6
6
  var AsyncCreateAutomationRequest_1 = require("./AsyncCreateAutomationRequest");
@@ -69,3 +69,5 @@ var FindOneRequest_1 = require("./FindOneRequest");
69
69
  Object.defineProperty(exports, "FindOneRequest", { enumerable: true, get: function () { return FindOneRequest_1.FindOneRequest; } });
70
70
  var LlmRequest_1 = require("./LlmRequest");
71
71
  Object.defineProperty(exports, "LlmRequest", { enumerable: true, get: function () { return LlmRequest_1.LlmRequest; } });
72
+ var WaitForPageRequest_1 = require("./WaitForPageRequest");
73
+ Object.defineProperty(exports, "WaitForPageRequest", { enumerable: true, get: function () { return WaitForPageRequest_1.WaitForPageRequest; } });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../../../index";
5
+ import * as Airtop from "../../../../api/index";
6
+ import * as core from "../../../../core";
7
+ export declare const WaitForPageRequestTargetStatus: core.serialization.Schema<serializers.WaitForPageRequestTargetStatus.Raw, Airtop.WaitForPageRequestTargetStatus>;
8
+ export declare namespace WaitForPageRequestTargetStatus {
9
+ type Raw = "domcontentloaded" | "load";
10
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.WaitForPageRequestTargetStatus = void 0;
40
+ const core = __importStar(require("../../../../core"));
41
+ exports.WaitForPageRequestTargetStatus = core.serialization.enum_(["domcontentloaded", "load"]);
@@ -1,2 +1,3 @@
1
1
  export * from "./CreateWindowInputV1BodyWaitUntil";
2
2
  export * from "./WindowLoadUrlV1BodyWaitUntil";
3
+ export * from "./WaitForPageRequestTargetStatus";
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./CreateWindowInputV1BodyWaitUntil"), exports);
18
18
  __exportStar(require("./WindowLoadUrlV1BodyWaitUntil"), exports);
19
+ __exportStar(require("./WaitForPageRequestTargetStatus"), exports);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index";
5
+ import * as Airtop from "../../api/index";
6
+ import * as core from "../../core";
7
+ export declare const FileEventData: core.serialization.ObjectSchema<serializers.FileEventData.Raw, Airtop.FileEventData>;
8
+ export declare namespace FileEventData {
9
+ interface Raw {
10
+ error: string;
11
+ filePath: string;
12
+ }
13
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.FileEventData = void 0;
40
+ const core = __importStar(require("../../core"));
41
+ exports.FileEventData = core.serialization.object({
42
+ error: core.serialization.string(),
43
+ filePath: core.serialization.string(),
44
+ });
@@ -4,13 +4,14 @@
4
4
  import * as serializers from "../index";
5
5
  import * as Airtop from "../../api/index";
6
6
  import * as core from "../../core";
7
+ import { FileEventData } from "./FileEventData";
7
8
  import { FileEventMessageStatus } from "./FileEventMessageStatus";
8
9
  export declare const FileEventMessage: core.serialization.ObjectSchema<serializers.FileEventMessage.Raw, Airtop.FileEventMessage>;
9
10
  export declare namespace FileEventMessage {
10
11
  interface Raw {
11
12
  downloadUrl: string;
12
13
  event: string;
13
- eventData?: unknown | null;
14
+ eventData?: FileEventData.Raw | null;
14
15
  eventTime: string;
15
16
  fileId: string;
16
17
  status: FileEventMessageStatus.Raw;
@@ -38,11 +38,12 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.FileEventMessage = void 0;
40
40
  const core = __importStar(require("../../core"));
41
+ const FileEventData_1 = require("./FileEventData");
41
42
  const FileEventMessageStatus_1 = require("./FileEventMessageStatus");
42
43
  exports.FileEventMessage = core.serialization.object({
43
44
  downloadUrl: core.serialization.string(),
44
45
  event: core.serialization.string(),
45
- eventData: core.serialization.unknown().optional(),
46
+ eventData: FileEventData_1.FileEventData.optional(),
46
47
  eventTime: core.serialization.date(),
47
48
  fileId: core.serialization.string(),
48
49
  status: FileEventMessageStatus_1.FileEventMessageStatus,
@@ -29,6 +29,7 @@ export * from "./ExternalSessionAiResponseMetadata";
29
29
  export * from "./ExternalSessionAiResponseMetadataUsage";
30
30
  export * from "./ExternalSessionConfig";
31
31
  export * from "./ExternalSessionWithConnectionInfo";
32
+ export * from "./FileEventData";
32
33
  export * from "./FileEventMessageStatus";
33
34
  export * from "./FileEventMessage";
34
35
  export * from "./FilesResponse";
@@ -45,6 +45,7 @@ __exportStar(require("./ExternalSessionAiResponseMetadata"), exports);
45
45
  __exportStar(require("./ExternalSessionAiResponseMetadataUsage"), exports);
46
46
  __exportStar(require("./ExternalSessionConfig"), exports);
47
47
  __exportStar(require("./ExternalSessionWithConnectionInfo"), exports);
48
+ __exportStar(require("./FileEventData"), exports);
48
49
  __exportStar(require("./FileEventMessageStatus"), exports);
49
50
  __exportStar(require("./FileEventMessage"), exports);
50
51
  __exportStar(require("./FilesResponse"), exports);
package/utils/upload.js CHANGED
@@ -8,16 +8,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.uploadFileAndSelectInput = uploadFileAndSelectInput;
16
+ const path_1 = __importDefault(require("path"));
13
17
  function uploadFileAndSelectInput(_a) {
14
18
  return __awaiter(this, arguments, void 0, function* ({ client, sessionId, windowId, configuration, }) {
19
+ var _b;
15
20
  const windowInfo = yield client.windows.getWindowInfo(sessionId, windowId);
16
21
  if (!windowInfo) {
17
22
  throw new Error('window not found');
18
23
  }
19
24
  client.log(`starting file upload: sessionId: ${sessionId}, windowId: ${windowId}, uploadFilePath: ${configuration.uploadFilePath}`);
20
- const fileUploadResponse = yield client.files.upload(configuration.uploadFilePath);
25
+ const fileUploadResponse = yield client.files.upload(configuration.uploadFilePath, {
26
+ fileName: (_b = configuration.fileName) !== null && _b !== void 0 ? _b : path_1.default.basename(configuration.uploadFilePath),
27
+ });
21
28
  if (fileUploadResponse.errors && fileUploadResponse.errors.length > 0) {
22
29
  client.log(`file upload failed: ${JSON.stringify(fileUploadResponse.errors)}`);
23
30
  throw new Error('file upload failed');
@@ -28,7 +35,7 @@ function uploadFileAndSelectInput(_a) {
28
35
  sessionIds: [sessionId],
29
36
  });
30
37
  client.log('file pushed to session');
31
- client.log('waiting for file upload to become available');
38
+ client.log(`waiting for file upload to become available ${fileId}`);
32
39
  const waitResult = yield client.sessions.waitForUploadAvailable(sessionId, fileId);
33
40
  if (waitResult) {
34
41
  client.log('file upload available');
@@ -37,12 +44,10 @@ function uploadFileAndSelectInput(_a) {
37
44
  client.log('file upload not available within timeout');
38
45
  throw new Error('file upload not available within timeout');
39
46
  }
40
- client.log('executing file input interaction');
41
- const fileInputResponse = yield client.windows.fileInput(sessionId, windowId, {
42
- fileId: fileId,
43
- elementDescription: configuration.elementDescription,
44
- });
47
+ client.log(`executing file input interaction ${JSON.stringify(configuration)}`);
48
+ const fileInputResponse = yield client.windows.fileInput(sessionId, windowId, Object.assign({ fileId: fileId }, configuration));
45
49
  if (fileInputResponse.errors && fileInputResponse.errors.length > 0) {
50
+ client.log(`file input failed: ${JSON.stringify(fileInputResponse.errors)}`);
46
51
  throw new Error('file input failed');
47
52
  }
48
53
  client.log('file upload and file input interaction complete');
package/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.41-beta0";
1
+ export declare const SDK_VERSION = "0.1.42-beta0";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.1.41-beta0";
4
+ exports.SDK_VERSION = "0.1.42-beta0";
@@ -336,6 +336,7 @@ class AirtopSessions extends Client_1.Sessions {
336
336
  */
337
337
  waitForUploadAvailable(sessionId_1, fileId_1) {
338
338
  return __awaiter(this, arguments, void 0, function* (sessionId, fileId, timeoutSeconds = 300) {
339
+ this.log(`waiting for uploaded file to be available on session: ${sessionId} ${fileId}`);
339
340
  // Create a promise that resolves to null after the timeout
340
341
  const timeoutPromise = new Promise((resolve) => {
341
342
  setTimeout(() => resolve(null), timeoutSeconds * 1000);
@@ -351,9 +352,15 @@ class AirtopSessions extends Client_1.Sessions {
351
352
  const event = _c;
352
353
  const e = event;
353
354
  if (e.event === 'file_upload_status') {
354
- this.log(`file_upload_status message received:\n${JSON.stringify(event, null, 2)}`);
355
- if (e.status === 'available' && e.fileId === fileId) {
356
- return event;
355
+ if (e.fileId === fileId) {
356
+ if (e.status === 'available') {
357
+ this.log(`uploaded file is now available on session: ${sessionId} ${fileId}`);
358
+ return event;
359
+ }
360
+ if (e.status === 'upload_failed') {
361
+ this.log(`upload failed: ${sessionId} ${fileId}`);
362
+ throw new Error(`upload failed: ${e.eventData.error}`);
363
+ }
357
364
  }
358
365
  }
359
366
  }
@@ -409,7 +416,7 @@ class AirtopSessions extends Client_1.Sessions {
409
416
  }
410
417
  lastCallbackPromise = lastCallbackPromise
411
418
  .then(() => callback(msg))
412
- .catch(error => this.log(`Error in captcha callback: ${error}`));
419
+ .catch((error) => this.log(`Error in captcha callback: ${error}`));
413
420
  }
414
421
  }
415
422
  }
@@ -420,7 +427,7 @@ class AirtopSessions extends Client_1.Sessions {
420
427
  }
421
428
  finally { if (e_5) throw e_5.error; }
422
429
  }
423
- }))().catch(error => {
430
+ }))().catch((error) => {
424
431
  if (error.name !== 'AbortError') {
425
432
  this.log(`Error in event processing: ${error}`);
426
433
  }