@airtop/sdk 0.1.7 → 0.1.9

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 (76) hide show
  1. package/api/resources/profiles/client/Client.js +4 -4
  2. package/api/resources/sessions/client/Client.d.ts +9 -0
  3. package/api/resources/sessions/client/Client.js +63 -10
  4. package/api/resources/windows/client/Client.d.ts +10 -0
  5. package/api/resources/windows/client/Client.js +85 -22
  6. package/api/resources/windows/client/requests/SessionPaginatedExtractionHandlerRequestBody.d.ts +23 -0
  7. package/api/resources/windows/client/requests/SessionPaginatedExtractionHandlerRequestBody.js +5 -0
  8. package/api/resources/windows/client/requests/index.d.ts +1 -0
  9. package/api/types/ExternalProfileV1.d.ts +1 -1
  10. package/api/types/PaginatedExtractionConfig.d.ts +11 -0
  11. package/api/types/PaginatedExtractionConfig.js +5 -0
  12. package/api/types/SessionConfigV1.d.ts +2 -0
  13. package/api/types/SessionConfigV1ProxyItem.d.ts +1 -1
  14. package/api/types/SessionPageQueryHandlerRequestBody.d.ts +2 -2
  15. package/api/types/StatusMessageStatus.d.ts +3 -1
  16. package/api/types/StatusMessageStatus.js +2 -0
  17. package/api/types/index.d.ts +1 -0
  18. package/api/types/index.js +1 -0
  19. package/dist/api/resources/profiles/client/Client.js +4 -4
  20. package/dist/api/resources/sessions/client/Client.d.ts +9 -0
  21. package/dist/api/resources/sessions/client/Client.js +63 -10
  22. package/dist/api/resources/windows/client/Client.d.ts +10 -0
  23. package/dist/api/resources/windows/client/Client.js +85 -22
  24. package/dist/api/resources/windows/client/requests/SessionPaginatedExtractionHandlerRequestBody.d.ts +23 -0
  25. package/dist/api/resources/windows/client/requests/SessionPaginatedExtractionHandlerRequestBody.js +5 -0
  26. package/dist/api/resources/windows/client/requests/index.d.ts +1 -0
  27. package/dist/api/types/ExternalProfileV1.d.ts +1 -1
  28. package/dist/api/types/PaginatedExtractionConfig.d.ts +11 -0
  29. package/dist/api/types/PaginatedExtractionConfig.js +5 -0
  30. package/dist/api/types/SessionConfigV1.d.ts +2 -0
  31. package/dist/api/types/SessionConfigV1ProxyItem.d.ts +1 -1
  32. package/dist/api/types/SessionPageQueryHandlerRequestBody.d.ts +2 -2
  33. package/dist/api/types/StatusMessageStatus.d.ts +3 -1
  34. package/dist/api/types/StatusMessageStatus.js +2 -0
  35. package/dist/api/types/index.d.ts +1 -0
  36. package/dist/api/types/index.js +1 -0
  37. package/dist/serialization/resources/windows/client/requests/SessionPaginatedExtractionHandlerRequestBody.d.ts +17 -0
  38. package/dist/serialization/resources/windows/client/requests/SessionPaginatedExtractionHandlerRequestBody.js +38 -0
  39. package/dist/serialization/resources/windows/client/requests/index.d.ts +1 -0
  40. package/dist/serialization/resources/windows/client/requests/index.js +3 -1
  41. package/dist/serialization/types/PaginatedExtractionConfig.d.ts +14 -0
  42. package/dist/serialization/types/PaginatedExtractionConfig.js +35 -0
  43. package/dist/serialization/types/SessionConfigV1.d.ts +1 -0
  44. package/dist/serialization/types/SessionConfigV1.js +1 -0
  45. package/dist/serialization/types/StatusMessageStatus.d.ts +1 -1
  46. package/dist/serialization/types/StatusMessageStatus.js +1 -1
  47. package/dist/serialization/types/index.d.ts +1 -0
  48. package/dist/serialization/types/index.js +1 -0
  49. package/dist/utils/batch-operate/SessionQueue.d.ts +1 -2
  50. package/dist/utils/batch-operate/WindowQueue.d.ts +1 -2
  51. package/dist/utils/batch-operate/batch-util.js +2 -4
  52. package/dist/wrapper/AirtopClient.d.ts +2 -0
  53. package/dist/wrapper/AirtopClient.js +36 -0
  54. package/dist/wrapper/AirtopWindows.d.ts +34 -0
  55. package/dist/wrapper/AirtopWindows.js +55 -0
  56. package/package.json +3 -2
  57. package/reference.md +75 -15
  58. package/serialization/resources/windows/client/requests/SessionPaginatedExtractionHandlerRequestBody.d.ts +17 -0
  59. package/serialization/resources/windows/client/requests/SessionPaginatedExtractionHandlerRequestBody.js +38 -0
  60. package/serialization/resources/windows/client/requests/index.d.ts +1 -0
  61. package/serialization/resources/windows/client/requests/index.js +3 -1
  62. package/serialization/types/PaginatedExtractionConfig.d.ts +14 -0
  63. package/serialization/types/PaginatedExtractionConfig.js +35 -0
  64. package/serialization/types/SessionConfigV1.d.ts +1 -0
  65. package/serialization/types/SessionConfigV1.js +1 -0
  66. package/serialization/types/StatusMessageStatus.d.ts +1 -1
  67. package/serialization/types/StatusMessageStatus.js +1 -1
  68. package/serialization/types/index.d.ts +1 -0
  69. package/serialization/types/index.js +1 -0
  70. package/utils/batch-operate/SessionQueue.d.ts +1 -2
  71. package/utils/batch-operate/WindowQueue.d.ts +1 -2
  72. package/utils/batch-operate/batch-util.js +2 -4
  73. package/wrapper/AirtopClient.d.ts +2 -0
  74. package/wrapper/AirtopClient.js +36 -0
  75. package/wrapper/AirtopWindows.d.ts +34 -0
  76. package/wrapper/AirtopWindows.js +55 -0
@@ -1,4 +1,27 @@
1
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -14,15 +37,28 @@ const Client_1 = require("../Client"); // alias the Fern generated client
14
37
  const AirtopSessions_1 = require("./AirtopSessions");
15
38
  const AirtopWindows_1 = require("./AirtopWindows");
16
39
  const utils_1 = require("../utils");
40
+ const core = __importStar(require("../core"));
17
41
  class AirtopClient {
18
42
  constructor(_options) {
19
43
  this._options = _options;
20
44
  this.batchOperate = (urls, operation, config) => __awaiter(this, void 0, void 0, function* () {
21
45
  return yield (0, utils_1.batchOperate)(urls, operation, this, config);
22
46
  });
47
+ const version = require('../package.json').version; //we don't control tsconfig.json so we can't use resolveJsonModule
48
+ if (!_options.fetcher) {
49
+ _options.fetcher = (req) => {
50
+ return core.fetcher(Object.assign(Object.assign({}, req), { headers: Object.assign(Object.assign({}, req.headers), { "x-airtop-sdk-source": "javascript", "x-airtop-sdk-version": version }) }));
51
+ };
52
+ }
23
53
  this._client = new Client_1.AirtopClient(_options);
24
54
  this.debug = (_options === null || _options === void 0 ? void 0 : _options.debug) || false;
25
55
  }
56
+ setApiKey(apiKey) {
57
+ this._options.apiKey = apiKey;
58
+ }
59
+ setEnvironment(environment) {
60
+ this._options.environment = environment;
61
+ }
26
62
  get sessions() {
27
63
  var _a;
28
64
  return ((_a = this._sessions) !== null && _a !== void 0 ? _a : (this._sessions = new AirtopSessions_1.AirtopSessions(this._options, this.debug)));
@@ -80,6 +80,40 @@ export declare class AirtopWindows extends WindowsClass {
80
80
  }, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.AiPromptResponse>;
81
81
  getWindowInfoForPuppeteerPage(session: Airtop.ExternalSessionWithConnectionInfo, page: puppeteer.Page, request?: Airtop.GetWindowInfoRequest, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.WindowResponse>;
82
82
  getWindowInfoForPlaywrightPage(session: Airtop.ExternalSessionWithConnectionInfo, page: playwright.Page, request?: Airtop.GetWindowInfoRequest, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.WindowResponse>;
83
+ /**
84
+ * @param {string} sessionId - The session id for the window.
85
+ * @param {string} windowId - The Airtop window id of the browser window.
86
+ * @param {Airtop.SessionClickHandlerRequestBody} request
87
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
88
+ *
89
+ * @example
90
+ * await client.windows.click("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
91
+ * elementDescription: "The login button"
92
+ * })
93
+ */
94
+ click(sessionId: string, windowId: string, request: Airtop.SessionClickHandlerRequestBody, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.AiPromptResponse>;
95
+ /**
96
+ * @param {string} sessionId - The session id for the window.
97
+ * @param {string} windowId - The Airtop window id of the browser window.
98
+ * @param {Airtop.SessionHoverHandlerRequestBody} request
99
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
100
+ *
101
+ * @example
102
+ * await client.windows.hover("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
103
+ */
104
+ hover(sessionId: string, windowId: string, request?: Airtop.SessionHoverHandlerRequestBody, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.AiPromptResponse>;
105
+ /**
106
+ * @param {string} sessionId - The session id for the window.
107
+ * @param {string} windowId - The Airtop window id of the browser window.
108
+ * @param {Airtop.SessionTypeHandlerRequestBody} request
109
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
110
+ *
111
+ * @example
112
+ * await client.windows.type("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
113
+ * text: "Example text"
114
+ * })
115
+ */
116
+ type(sessionId: string, windowId: string, request: Airtop.SessionTypeHandlerRequestBody, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.AiPromptResponse>;
83
117
  private executeSeleniumCDPCommand;
84
118
  getWindowInfoForSeleniumDriver(session: Airtop.ExternalSessionWithConnectionInfo, driver: seleniumWebdriver.WebDriver, request?: Airtop.GetWindowInfoRequest, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.WindowResponse>;
85
119
  }
@@ -135,6 +135,61 @@ class AirtopWindows extends Client_1.Windows {
135
135
  return yield this.getWindowInfo(session.id, targetId, request, requestOptions);
136
136
  });
137
137
  }
138
+ /**
139
+ * @param {string} sessionId - The session id for the window.
140
+ * @param {string} windowId - The Airtop window id of the browser window.
141
+ * @param {Airtop.SessionClickHandlerRequestBody} request
142
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
143
+ *
144
+ * @example
145
+ * await client.windows.click("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
146
+ * elementDescription: "The login button"
147
+ * })
148
+ */
149
+ click(sessionId, windowId, request, requestOptions) {
150
+ const _super = Object.create(null, {
151
+ click: { get: () => super.click }
152
+ });
153
+ return __awaiter(this, void 0, void 0, function* () {
154
+ return _super.click.call(this, sessionId, windowId, request, Object.assign(Object.assign({ timeoutInSeconds: 600 }, requestOptions), { maxRetries: 0 }));
155
+ });
156
+ }
157
+ /**
158
+ * @param {string} sessionId - The session id for the window.
159
+ * @param {string} windowId - The Airtop window id of the browser window.
160
+ * @param {Airtop.SessionHoverHandlerRequestBody} request
161
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
162
+ *
163
+ * @example
164
+ * await client.windows.hover("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
165
+ */
166
+ hover(sessionId, windowId, request = {}, requestOptions) {
167
+ const _super = Object.create(null, {
168
+ hover: { get: () => super.hover }
169
+ });
170
+ return __awaiter(this, void 0, void 0, function* () {
171
+ return _super.hover.call(this, sessionId, windowId, request, Object.assign(Object.assign({ timeoutInSeconds: 600 }, requestOptions), { maxRetries: 0 }));
172
+ });
173
+ }
174
+ /**
175
+ * @param {string} sessionId - The session id for the window.
176
+ * @param {string} windowId - The Airtop window id of the browser window.
177
+ * @param {Airtop.SessionTypeHandlerRequestBody} request
178
+ * @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
179
+ *
180
+ * @example
181
+ * await client.windows.type("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430", {
182
+ * text: "Example text"
183
+ * })
184
+ */
185
+ type(sessionId, windowId, request, requestOptions) {
186
+ const _super = Object.create(null, {
187
+ type: { get: () => super.type }
188
+ });
189
+ return __awaiter(this, void 0, void 0, function* () {
190
+ return _super.type.call(this, sessionId, windowId, request, Object.assign(Object.assign({ timeoutInSeconds: 600 }, requestOptions), { maxRetries: 0 }));
191
+ });
192
+ }
138
193
  executeSeleniumCDPCommand(driver, session, apiKey) {
139
194
  return __awaiter(this, void 0, void 0, function* () {
140
195
  // Get the current WebDriver session ID