@airtop/sdk 0.1.40 → 0.1.41-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.
- package/README.md +9 -10
- package/api/resources/automations/client/Client.js +4 -4
- package/api/resources/files/client/Client.d.ts +11 -0
- package/api/resources/files/client/Client.js +52 -4
- package/api/resources/files/client/requests/PushFileBodyV1.d.ts +11 -0
- package/api/resources/files/client/requests/PushFileBodyV1.js +5 -0
- package/api/resources/files/client/requests/index.d.ts +1 -0
- package/api/resources/profiles/client/Client.js +1 -1
- package/api/resources/requests/client/Client.js +1 -1
- package/api/resources/sessions/client/Client.js +6 -6
- package/api/resources/sessions/types/SessionsEventsResponse.d.ts +4 -4
- package/api/resources/sessions/types/index.d.ts +1 -1
- package/api/resources/sessions/types/index.js +1 -1
- package/api/resources/windows/client/Client.d.ts +228 -0
- package/api/resources/windows/client/Client.js +1162 -201
- package/api/resources/windows/client/requests/ActRequest.d.ts +30 -0
- package/api/resources/windows/client/requests/ActRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncClickRequest.d.ts +29 -0
- package/api/resources/windows/client/requests/AsyncClickRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncFileInputRequest.d.ts +33 -0
- package/api/resources/windows/client/requests/AsyncFileInputRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncHoverRequest.d.ts +27 -0
- package/api/resources/windows/client/requests/AsyncHoverRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncMonitorRequest.d.ts +27 -0
- package/api/resources/windows/client/requests/AsyncMonitorRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncPageQueryRequest.d.ts +29 -0
- package/api/resources/windows/client/requests/AsyncPageQueryRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncPaginatedExtractionRequest.d.ts +27 -0
- package/api/resources/windows/client/requests/AsyncPaginatedExtractionRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncPromptContentRequest.d.ts +29 -0
- package/api/resources/windows/client/requests/AsyncPromptContentRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncScreenshotRequest.d.ts +23 -0
- package/api/resources/windows/client/requests/AsyncScreenshotRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncSummarizeContentRequest.d.ts +25 -0
- package/api/resources/windows/client/requests/AsyncSummarizeContentRequest.js +5 -0
- package/api/resources/windows/client/requests/AsyncTypeRequest.d.ts +37 -0
- package/api/resources/windows/client/requests/AsyncTypeRequest.js +5 -0
- package/api/resources/windows/client/requests/ExtractRequest.d.ts +30 -0
- package/api/resources/windows/client/requests/ExtractRequest.js +5 -0
- package/api/resources/windows/client/requests/FindManyRequest.d.ts +30 -0
- package/api/resources/windows/client/requests/FindManyRequest.js +5 -0
- package/api/resources/windows/client/requests/FindOneRequest.d.ts +30 -0
- package/api/resources/windows/client/requests/FindOneRequest.js +5 -0
- package/api/resources/windows/client/requests/LlmRequest.d.ts +25 -0
- package/api/resources/windows/client/requests/LlmRequest.js +5 -0
- package/api/resources/windows/client/requests/OperatorPromptV1Body.d.ts +25 -0
- package/api/resources/windows/client/requests/OperatorPromptV1Body.js +5 -0
- package/api/resources/windows/client/requests/SessionFileInputHandlerRequestBody.d.ts +31 -0
- package/api/resources/windows/client/requests/SessionFileInputHandlerRequestBody.js +5 -0
- package/api/resources/windows/client/requests/index.d.ts +17 -0
- package/api/types/AsyncOperatorPromptResponseEnvelope.d.ts +9 -0
- package/api/types/AsyncOperatorPromptResponseEnvelope.js +5 -0
- package/api/types/FileEventMessage.d.ts +1 -0
- package/api/types/index.d.ts +1 -0
- package/api/types/index.js +1 -0
- package/dist/api/resources/automations/client/Client.js +4 -4
- package/dist/api/resources/files/client/Client.d.ts +11 -0
- package/dist/api/resources/files/client/Client.js +52 -4
- package/dist/api/resources/files/client/requests/PushFileBodyV1.d.ts +11 -0
- package/dist/api/resources/files/client/requests/PushFileBodyV1.js +5 -0
- package/dist/api/resources/files/client/requests/index.d.ts +1 -0
- package/dist/api/resources/profiles/client/Client.js +1 -1
- package/dist/api/resources/requests/client/Client.js +1 -1
- package/dist/api/resources/sessions/client/Client.js +6 -6
- package/dist/api/resources/sessions/types/SessionsEventsResponse.d.ts +4 -4
- package/dist/api/resources/sessions/types/index.d.ts +1 -1
- package/dist/api/resources/sessions/types/index.js +1 -1
- package/dist/api/resources/windows/client/Client.d.ts +228 -0
- package/dist/api/resources/windows/client/Client.js +1162 -201
- package/dist/api/resources/windows/client/requests/ActRequest.d.ts +30 -0
- package/dist/api/resources/windows/client/requests/ActRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncClickRequest.d.ts +29 -0
- package/dist/api/resources/windows/client/requests/AsyncClickRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncFileInputRequest.d.ts +33 -0
- package/dist/api/resources/windows/client/requests/AsyncFileInputRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncHoverRequest.d.ts +27 -0
- package/dist/api/resources/windows/client/requests/AsyncHoverRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncMonitorRequest.d.ts +27 -0
- package/dist/api/resources/windows/client/requests/AsyncMonitorRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncPageQueryRequest.d.ts +29 -0
- package/dist/api/resources/windows/client/requests/AsyncPageQueryRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncPaginatedExtractionRequest.d.ts +27 -0
- package/dist/api/resources/windows/client/requests/AsyncPaginatedExtractionRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncPromptContentRequest.d.ts +29 -0
- package/dist/api/resources/windows/client/requests/AsyncPromptContentRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncScreenshotRequest.d.ts +23 -0
- package/dist/api/resources/windows/client/requests/AsyncScreenshotRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncSummarizeContentRequest.d.ts +25 -0
- package/dist/api/resources/windows/client/requests/AsyncSummarizeContentRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/AsyncTypeRequest.d.ts +37 -0
- package/dist/api/resources/windows/client/requests/AsyncTypeRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/ExtractRequest.d.ts +30 -0
- package/dist/api/resources/windows/client/requests/ExtractRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/FindManyRequest.d.ts +30 -0
- package/dist/api/resources/windows/client/requests/FindManyRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/FindOneRequest.d.ts +30 -0
- package/dist/api/resources/windows/client/requests/FindOneRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/LlmRequest.d.ts +25 -0
- package/dist/api/resources/windows/client/requests/LlmRequest.js +5 -0
- package/dist/api/resources/windows/client/requests/OperatorPromptV1Body.d.ts +25 -0
- package/dist/api/resources/windows/client/requests/OperatorPromptV1Body.js +5 -0
- package/dist/api/resources/windows/client/requests/SessionFileInputHandlerRequestBody.d.ts +31 -0
- package/dist/api/resources/windows/client/requests/SessionFileInputHandlerRequestBody.js +5 -0
- package/dist/api/resources/windows/client/requests/index.d.ts +17 -0
- package/dist/api/types/AsyncOperatorPromptResponseEnvelope.d.ts +9 -0
- package/dist/api/types/AsyncOperatorPromptResponseEnvelope.js +5 -0
- package/dist/api/types/FileEventMessage.d.ts +1 -0
- package/dist/api/types/index.d.ts +1 -0
- package/dist/api/types/index.js +1 -0
- package/dist/serialization/resources/files/client/requests/PushFileBodyV1.d.ts +12 -0
- package/dist/serialization/resources/files/client/requests/PushFileBodyV1.js +43 -0
- package/dist/serialization/resources/files/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/files/client/requests/index.js +3 -1
- package/dist/serialization/resources/sessions/types/SessionsEventsResponse.d.ts +5 -5
- package/dist/serialization/resources/sessions/types/SessionsEventsResponse.js +2 -2
- package/dist/serialization/resources/sessions/types/index.d.ts +1 -1
- package/dist/serialization/resources/sessions/types/index.js +1 -1
- package/dist/serialization/resources/windows/client/requests/ActRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/ActRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/AsyncClickRequest.d.ts +20 -0
- package/dist/serialization/resources/windows/client/requests/AsyncClickRequest.js +51 -0
- package/dist/serialization/resources/windows/client/requests/AsyncFileInputRequest.d.ts +22 -0
- package/dist/serialization/resources/windows/client/requests/AsyncFileInputRequest.js +53 -0
- package/dist/serialization/resources/windows/client/requests/AsyncHoverRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/AsyncHoverRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/AsyncMonitorRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/AsyncMonitorRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPageQueryRequest.d.ts +20 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPageQueryRequest.js +51 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPaginatedExtractionRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPaginatedExtractionRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPromptContentRequest.d.ts +20 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPromptContentRequest.js +51 -0
- package/dist/serialization/resources/windows/client/requests/AsyncScreenshotRequest.d.ts +18 -0
- package/dist/serialization/resources/windows/client/requests/AsyncScreenshotRequest.js +49 -0
- package/dist/serialization/resources/windows/client/requests/AsyncSummarizeContentRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/AsyncSummarizeContentRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/AsyncTypeRequest.d.ts +24 -0
- package/dist/serialization/resources/windows/client/requests/AsyncTypeRequest.js +55 -0
- package/dist/serialization/resources/windows/client/requests/ExtractRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/ExtractRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/FindManyRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/FindManyRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/FindOneRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/FindOneRequest.js +50 -0
- package/dist/serialization/resources/windows/client/requests/LlmRequest.d.ts +17 -0
- package/dist/serialization/resources/windows/client/requests/LlmRequest.js +48 -0
- package/dist/serialization/resources/windows/client/requests/OperatorPromptV1Body.d.ts +17 -0
- package/dist/serialization/resources/windows/client/requests/OperatorPromptV1Body.js +48 -0
- package/dist/serialization/resources/windows/client/requests/SessionFileInputHandlerRequestBody.d.ts +20 -0
- package/dist/serialization/resources/windows/client/requests/SessionFileInputHandlerRequestBody.js +51 -0
- package/dist/serialization/resources/windows/client/requests/index.d.ts +17 -0
- package/dist/serialization/resources/windows/client/requests/index.js +35 -1
- package/dist/serialization/types/AsyncOperatorPromptResponseEnvelope.d.ts +15 -0
- package/dist/serialization/types/AsyncOperatorPromptResponseEnvelope.js +46 -0
- package/dist/serialization/types/FileEventMessage.d.ts +1 -0
- package/dist/serialization/types/FileEventMessage.js +1 -0
- package/dist/serialization/types/index.d.ts +1 -0
- package/dist/serialization/types/index.js +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/upload.d.ts +13 -0
- package/dist/utils/upload.js +55 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/AirtopClient.js +1 -1
- package/dist/wrapper/AirtopFiles.js +3 -3
- package/dist/wrapper/AirtopSessions.d.ts +24 -0
- package/dist/wrapper/AirtopSessions.js +103 -0
- package/dist/wrapper/AirtopWindows.d.ts +25 -1
- package/dist/wrapper/AirtopWindows.js +23 -1
- package/package.json +1 -1
- package/reference.md +1492 -108
- package/serialization/resources/files/client/requests/PushFileBodyV1.d.ts +12 -0
- package/serialization/resources/files/client/requests/PushFileBodyV1.js +43 -0
- package/serialization/resources/files/client/requests/index.d.ts +1 -0
- package/serialization/resources/files/client/requests/index.js +3 -1
- package/serialization/resources/sessions/types/SessionsEventsResponse.d.ts +5 -5
- package/serialization/resources/sessions/types/SessionsEventsResponse.js +2 -2
- package/serialization/resources/sessions/types/index.d.ts +1 -1
- package/serialization/resources/sessions/types/index.js +1 -1
- package/serialization/resources/windows/client/requests/ActRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/ActRequest.js +50 -0
- package/serialization/resources/windows/client/requests/AsyncClickRequest.d.ts +20 -0
- package/serialization/resources/windows/client/requests/AsyncClickRequest.js +51 -0
- package/serialization/resources/windows/client/requests/AsyncFileInputRequest.d.ts +22 -0
- package/serialization/resources/windows/client/requests/AsyncFileInputRequest.js +53 -0
- package/serialization/resources/windows/client/requests/AsyncHoverRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/AsyncHoverRequest.js +50 -0
- package/serialization/resources/windows/client/requests/AsyncMonitorRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/AsyncMonitorRequest.js +50 -0
- package/serialization/resources/windows/client/requests/AsyncPageQueryRequest.d.ts +20 -0
- package/serialization/resources/windows/client/requests/AsyncPageQueryRequest.js +51 -0
- package/serialization/resources/windows/client/requests/AsyncPaginatedExtractionRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/AsyncPaginatedExtractionRequest.js +50 -0
- package/serialization/resources/windows/client/requests/AsyncPromptContentRequest.d.ts +20 -0
- package/serialization/resources/windows/client/requests/AsyncPromptContentRequest.js +51 -0
- package/serialization/resources/windows/client/requests/AsyncScreenshotRequest.d.ts +18 -0
- package/serialization/resources/windows/client/requests/AsyncScreenshotRequest.js +49 -0
- package/serialization/resources/windows/client/requests/AsyncSummarizeContentRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/AsyncSummarizeContentRequest.js +50 -0
- package/serialization/resources/windows/client/requests/AsyncTypeRequest.d.ts +24 -0
- package/serialization/resources/windows/client/requests/AsyncTypeRequest.js +55 -0
- package/serialization/resources/windows/client/requests/ExtractRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/ExtractRequest.js +50 -0
- package/serialization/resources/windows/client/requests/FindManyRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/FindManyRequest.js +50 -0
- package/serialization/resources/windows/client/requests/FindOneRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/FindOneRequest.js +50 -0
- package/serialization/resources/windows/client/requests/LlmRequest.d.ts +17 -0
- package/serialization/resources/windows/client/requests/LlmRequest.js +48 -0
- package/serialization/resources/windows/client/requests/OperatorPromptV1Body.d.ts +17 -0
- package/serialization/resources/windows/client/requests/OperatorPromptV1Body.js +48 -0
- package/serialization/resources/windows/client/requests/SessionFileInputHandlerRequestBody.d.ts +20 -0
- package/serialization/resources/windows/client/requests/SessionFileInputHandlerRequestBody.js +51 -0
- package/serialization/resources/windows/client/requests/index.d.ts +17 -0
- package/serialization/resources/windows/client/requests/index.js +35 -1
- package/serialization/types/AsyncOperatorPromptResponseEnvelope.d.ts +15 -0
- package/serialization/types/AsyncOperatorPromptResponseEnvelope.js +46 -0
- package/serialization/types/FileEventMessage.d.ts +1 -0
- package/serialization/types/FileEventMessage.js +1 -0
- package/serialization/types/index.d.ts +1 -0
- package/serialization/types/index.js +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/upload.d.ts +13 -0
- package/utils/upload.js +55 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/AirtopClient.js +1 -1
- package/wrapper/AirtopFiles.js +3 -3
- package/wrapper/AirtopSessions.d.ts +24 -0
- package/wrapper/AirtopSessions.js +103 -0
- package/wrapper/AirtopWindows.d.ts +25 -1
- package/wrapper/AirtopWindows.js +23 -1
@@ -326,5 +326,108 @@ class AirtopSessions extends Client_1.Sessions {
|
|
326
326
|
});
|
327
327
|
});
|
328
328
|
}
|
329
|
+
/**
|
330
|
+
* Waits for a file upload to become available to a session.
|
331
|
+
*
|
332
|
+
* @param sessionId - The session id for the file upload.
|
333
|
+
* @param fileId - The file id for the file upload.
|
334
|
+
* @param timeoutSeconds - The timeout in seconds.
|
335
|
+
* @returns The event for the file upload.
|
336
|
+
*/
|
337
|
+
waitForUploadAvailable(sessionId_1, fileId_1) {
|
338
|
+
return __awaiter(this, arguments, void 0, function* (sessionId, fileId, timeoutSeconds = 300) {
|
339
|
+
// Create a promise that resolves to null after the timeout
|
340
|
+
const timeoutPromise = new Promise((resolve) => {
|
341
|
+
setTimeout(() => resolve(null), timeoutSeconds * 1000);
|
342
|
+
});
|
343
|
+
// Create a promise for the event processing
|
344
|
+
const processEventsPromise = (() => __awaiter(this, void 0, void 0, function* () {
|
345
|
+
var _a, e_4, _b, _c;
|
346
|
+
const sessionEvents = yield this.events(sessionId, { all: true }, { timeoutInSeconds: timeoutSeconds });
|
347
|
+
try {
|
348
|
+
for (var _d = true, sessionEvents_4 = __asyncValues(sessionEvents), sessionEvents_4_1; sessionEvents_4_1 = yield sessionEvents_4.next(), _a = sessionEvents_4_1.done, !_a; _d = true) {
|
349
|
+
_c = sessionEvents_4_1.value;
|
350
|
+
_d = false;
|
351
|
+
const event = _c;
|
352
|
+
const e = event;
|
353
|
+
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;
|
357
|
+
}
|
358
|
+
}
|
359
|
+
}
|
360
|
+
}
|
361
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
362
|
+
finally {
|
363
|
+
try {
|
364
|
+
if (!_d && !_a && (_b = sessionEvents_4.return)) yield _b.call(sessionEvents_4);
|
365
|
+
}
|
366
|
+
finally { if (e_4) throw e_4.error; }
|
367
|
+
}
|
368
|
+
return null;
|
369
|
+
}))();
|
370
|
+
// Race the timeout against the event processing
|
371
|
+
return Promise.race([timeoutPromise, processEventsPromise]);
|
372
|
+
});
|
373
|
+
}
|
374
|
+
/**
|
375
|
+
* Captcha event listener
|
376
|
+
* Defaults to looking back 5 seconds in the event stream for the captcha event to be available.
|
377
|
+
* Use `lookbackSeconds` to control this behavior.
|
378
|
+
*
|
379
|
+
* @param {string} sessionId - The ID of the session to monitor
|
380
|
+
* @param {function} callback - The callback function to be called when a captcha event is received
|
381
|
+
* @param {Object} configuration - The optional configuration parameters for the function
|
382
|
+
* @param {number} [configuration.lookbackSeconds=5] - The number of seconds to look back for prior events. Default `5`. 0 means no lookback.
|
383
|
+
* @param {Sessions.RequestOptions} [requestOptions] - Optional request configuration including timeout
|
384
|
+
* @returns {function} - A function to stop listening for captcha events
|
385
|
+
*/
|
386
|
+
onCaptchaEvent(sessionId, callback, configuration, requestOptions) {
|
387
|
+
let lastCallbackPromise = Promise.resolve();
|
388
|
+
const abortController = new AbortController();
|
389
|
+
const startTime = new Date();
|
390
|
+
const { lookbackSeconds = 5 } = configuration || {};
|
391
|
+
const timeoutSeconds = (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) || 60;
|
392
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
393
|
+
var _a, e_5, _b, _c;
|
394
|
+
const sessionEvents = yield this.events(sessionId, { all: lookbackSeconds >= 0 }, Object.assign(Object.assign({ timeoutInSeconds: timeoutSeconds }, requestOptions), { abortSignal: abortController.signal }));
|
395
|
+
try {
|
396
|
+
for (var _d = true, sessionEvents_5 = __asyncValues(sessionEvents), sessionEvents_5_1; sessionEvents_5_1 = yield sessionEvents_5.next(), _a = sessionEvents_5_1.done, !_a; _d = true) {
|
397
|
+
_c = sessionEvents_5_1.value;
|
398
|
+
_d = false;
|
399
|
+
const event = _c;
|
400
|
+
const e = event;
|
401
|
+
if (e.event === 'captcha-event') {
|
402
|
+
this.log(`captcha-event message received:\n${JSON.stringify(event, null, 2)}`);
|
403
|
+
const msg = e;
|
404
|
+
const eventTime = Date.parse(e.eventTime);
|
405
|
+
const thresholdTime = startTime.getTime() - lookbackSeconds * 1000;
|
406
|
+
if (eventTime < thresholdTime) {
|
407
|
+
this.log('skipping captcha event because its timestamp is earlier than lookbackSeconds');
|
408
|
+
continue;
|
409
|
+
}
|
410
|
+
lastCallbackPromise = lastCallbackPromise
|
411
|
+
.then(() => callback(msg))
|
412
|
+
.catch(error => this.log(`Error in captcha callback: ${error}`));
|
413
|
+
}
|
414
|
+
}
|
415
|
+
}
|
416
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
417
|
+
finally {
|
418
|
+
try {
|
419
|
+
if (!_d && !_a && (_b = sessionEvents_5.return)) yield _b.call(sessionEvents_5);
|
420
|
+
}
|
421
|
+
finally { if (e_5) throw e_5.error; }
|
422
|
+
}
|
423
|
+
}))().catch(error => {
|
424
|
+
if (error.name !== 'AbortError') {
|
425
|
+
this.log(`Error in event processing: ${error}`);
|
426
|
+
}
|
427
|
+
});
|
428
|
+
return () => {
|
429
|
+
abortController.abort();
|
430
|
+
};
|
431
|
+
}
|
329
432
|
}
|
330
433
|
exports.AirtopSessions = AirtopSessions;
|
@@ -17,10 +17,16 @@ declare namespace seleniumWebdriver {
|
|
17
17
|
import type * as Airtop from '../api';
|
18
18
|
import { type Windows, Windows as WindowsClass, type Windows as WindowsNamespace } from '../api/resources/windows/client/Client';
|
19
19
|
import * as core from '../core';
|
20
|
+
import type { AirtopClient } from './AirtopClient';
|
21
|
+
type UploadAndFillFileInputConfiguration = Airtop.SessionFileInputHandlerRequestBody & {
|
22
|
+
uploadFilePath: string;
|
23
|
+
};
|
20
24
|
export declare class AirtopWindows extends WindowsClass {
|
25
|
+
readonly _client: AirtopClient;
|
21
26
|
readonly _options: WindowsNamespace.Options;
|
22
27
|
private apiKeySupplier;
|
23
|
-
|
28
|
+
private readonly mainClient;
|
29
|
+
constructor(_client: AirtopClient, _options: WindowsNamespace.Options, apiKeySupplier: core.Supplier<core.BearerToken | undefined>);
|
24
30
|
/**
|
25
31
|
* @param {string} sessionId - The session id for the window.
|
26
32
|
* @param {string} windowId - The Airtop window id of the browser window to target with an Airtop AI prompt.
|
@@ -176,5 +182,23 @@ export declare class AirtopWindows extends WindowsClass {
|
|
176
182
|
monitor(sessionId: string, windowId: string, request: Airtop.SessionMonitorHandlerRequestBody, requestOptions?: Windows.RequestOptions): Promise<Airtop.AiPromptResponse>;
|
177
183
|
private executeSeleniumCDPCommand;
|
178
184
|
getWindowInfoForSeleniumDriver(session: Airtop.ExternalSessionWithConnectionInfo, driver: seleniumWebdriver.WebDriver, request?: Airtop.GetWindowInfoRequest, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.WindowResponse>;
|
185
|
+
/**
|
186
|
+
* Upload a file, push the file to a session, and fill a file input field in a window.
|
187
|
+
* After this operation, the file input will be ready to be submitted.
|
188
|
+
*
|
189
|
+
* @param sessionId - The session id for the window.
|
190
|
+
* @param windowId - The window id of the browser window.
|
191
|
+
* @param {UploadAndFillFileInputConfiguration} configuration
|
192
|
+
* @param configuration.uploadFilePath - The path to the local file to upload.
|
193
|
+
* @param configuration.elementDescription - A natural language description of the file input to
|
194
|
+
* interact with (e.g. 'the file input', 'file upload selection box'). The interaction will be
|
195
|
+
* aborted if the target element cannot be found.
|
196
|
+
* @see Airtop.SessionFileInputHandlerRequestBody - For additional micro-interaction configuration options.
|
197
|
+
* @returns The file id and the ai response.
|
198
|
+
*/
|
199
|
+
uploadFileAndSelectInput(sessionId: string, windowId: string, configuration: UploadAndFillFileInputConfiguration): Promise<{
|
200
|
+
fileId: string;
|
201
|
+
aiResponse: Airtop.AiPromptResponse;
|
202
|
+
}>;
|
179
203
|
}
|
180
204
|
export {};
|
@@ -49,11 +49,14 @@ exports.AirtopWindows = void 0;
|
|
49
49
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
50
50
|
const Client_1 = require("../api/resources/windows/client/Client");
|
51
51
|
const core = __importStar(require("../core"));
|
52
|
+
const utils_1 = require("../utils");
|
52
53
|
class AirtopWindows extends Client_1.Windows {
|
53
|
-
constructor(_options, apiKeySupplier) {
|
54
|
+
constructor(_client, _options, apiKeySupplier) {
|
54
55
|
super(_options);
|
56
|
+
this._client = _client;
|
55
57
|
this._options = _options;
|
56
58
|
this.apiKeySupplier = apiKeySupplier;
|
59
|
+
this.mainClient = _client;
|
57
60
|
}
|
58
61
|
/**
|
59
62
|
* @param {string} sessionId - The session id for the window.
|
@@ -329,5 +332,24 @@ class AirtopWindows extends Client_1.Windows {
|
|
329
332
|
return yield this.getWindowInfo(session.id, targetId, request, requestOptions);
|
330
333
|
});
|
331
334
|
}
|
335
|
+
/**
|
336
|
+
* Upload a file, push the file to a session, and fill a file input field in a window.
|
337
|
+
* After this operation, the file input will be ready to be submitted.
|
338
|
+
*
|
339
|
+
* @param sessionId - The session id for the window.
|
340
|
+
* @param windowId - The window id of the browser window.
|
341
|
+
* @param {UploadAndFillFileInputConfiguration} configuration
|
342
|
+
* @param configuration.uploadFilePath - The path to the local file to upload.
|
343
|
+
* @param configuration.elementDescription - A natural language description of the file input to
|
344
|
+
* interact with (e.g. 'the file input', 'file upload selection box'). The interaction will be
|
345
|
+
* aborted if the target element cannot be found.
|
346
|
+
* @see Airtop.SessionFileInputHandlerRequestBody - For additional micro-interaction configuration options.
|
347
|
+
* @returns The file id and the ai response.
|
348
|
+
*/
|
349
|
+
uploadFileAndSelectInput(sessionId, windowId, configuration) {
|
350
|
+
return __awaiter(this, void 0, void 0, function* () {
|
351
|
+
return (0, utils_1.uploadFileAndSelectInput)({ client: this.mainClient, sessionId, windowId, configuration });
|
352
|
+
});
|
353
|
+
}
|
332
354
|
}
|
333
355
|
exports.AirtopWindows = AirtopWindows;
|