@airtop/sdk 0.1.14 → 0.1.15-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/Client.d.ts +3 -0
- package/Client.js +7 -2
- package/README.md +8 -6
- package/api/resources/index.d.ts +1 -0
- package/api/resources/index.js +2 -1
- package/api/resources/profiles/client/Client.js +2 -2
- package/api/resources/requests/client/Client.d.ts +34 -0
- package/api/resources/requests/client/Client.js +115 -0
- package/api/resources/requests/client/index.d.ts +1 -0
- package/api/resources/requests/client/index.js +2 -0
- package/api/resources/requests/index.d.ts +1 -0
- package/api/resources/requests/index.js +17 -0
- package/api/resources/sessions/client/Client.js +12 -12
- 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 +116 -0
- package/api/resources/windows/client/Client.js +654 -26
- 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/AsyncHoverRequest.d.ts +25 -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 +25 -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/SessionMonitorHandlerRequestBody.d.ts +25 -0
- package/api/resources/windows/client/requests/SessionMonitorHandlerRequestBody.js +5 -0
- package/api/resources/windows/client/requests/index.d.ts +10 -0
- package/api/types/AsyncConfig.d.ts +7 -0
- package/api/types/AsyncConfig.js +5 -0
- package/api/types/AsyncSessionAiResponseEnvelope.d.ts +9 -0
- package/api/types/AsyncSessionAiResponseEnvelope.js +5 -0
- package/api/types/BrowserWaitSelectorConfig.d.ts +11 -0
- package/api/types/BrowserWaitSelectorConfig.js +5 -0
- package/api/types/IntervalMonitorConfig.d.ts +9 -0
- package/api/types/IntervalMonitorConfig.js +5 -0
- package/api/types/MonitorConfig.d.ts +14 -0
- package/api/types/MonitorConfig.js +5 -0
- package/api/types/MonitorConfigIncludeVisualAnalysis.d.ts +12 -0
- package/api/types/MonitorConfigIncludeVisualAnalysis.js +11 -0
- package/api/types/MonitorConfigMonitorType.d.ts +11 -0
- package/api/types/MonitorConfigMonitorType.js +10 -0
- package/api/types/RequestStatusResponse.d.ts +8 -0
- package/api/types/RequestStatusResponse.js +5 -0
- package/api/types/index.d.ts +8 -0
- package/api/types/index.js +8 -0
- package/dist/Client.d.ts +3 -0
- package/dist/Client.js +7 -2
- package/dist/api/resources/index.d.ts +1 -0
- package/dist/api/resources/index.js +2 -1
- package/dist/api/resources/profiles/client/Client.js +2 -2
- package/dist/api/resources/requests/client/Client.d.ts +34 -0
- package/dist/api/resources/requests/client/Client.js +115 -0
- package/dist/api/resources/requests/client/index.d.ts +1 -0
- package/dist/api/resources/requests/client/index.js +2 -0
- package/dist/api/resources/requests/index.d.ts +1 -0
- package/dist/api/resources/requests/index.js +17 -0
- package/dist/api/resources/sessions/client/Client.js +12 -12
- 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 +116 -0
- package/dist/api/resources/windows/client/Client.js +654 -26
- 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/AsyncHoverRequest.d.ts +25 -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 +25 -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/SessionMonitorHandlerRequestBody.d.ts +25 -0
- package/dist/api/resources/windows/client/requests/SessionMonitorHandlerRequestBody.js +5 -0
- package/dist/api/resources/windows/client/requests/index.d.ts +10 -0
- package/dist/api/types/AsyncConfig.d.ts +7 -0
- package/dist/api/types/AsyncConfig.js +5 -0
- package/dist/api/types/AsyncSessionAiResponseEnvelope.d.ts +9 -0
- package/dist/api/types/AsyncSessionAiResponseEnvelope.js +5 -0
- package/dist/api/types/BrowserWaitSelectorConfig.d.ts +11 -0
- package/dist/api/types/BrowserWaitSelectorConfig.js +5 -0
- package/dist/api/types/IntervalMonitorConfig.d.ts +9 -0
- package/dist/api/types/IntervalMonitorConfig.js +5 -0
- package/dist/api/types/MonitorConfig.d.ts +14 -0
- package/dist/api/types/MonitorConfig.js +5 -0
- package/dist/api/types/MonitorConfigIncludeVisualAnalysis.d.ts +12 -0
- package/dist/api/types/MonitorConfigIncludeVisualAnalysis.js +11 -0
- package/dist/api/types/MonitorConfigMonitorType.d.ts +11 -0
- package/dist/api/types/MonitorConfigMonitorType.js +10 -0
- package/dist/api/types/RequestStatusResponse.d.ts +8 -0
- package/dist/api/types/RequestStatusResponse.js +5 -0
- package/dist/api/types/index.d.ts +8 -0
- package/dist/api/types/index.js +8 -0
- 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/AsyncClickRequest.d.ts +20 -0
- package/dist/serialization/resources/windows/client/requests/AsyncClickRequest.js +41 -0
- package/dist/serialization/resources/windows/client/requests/AsyncHoverRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/AsyncHoverRequest.js +40 -0
- package/dist/serialization/resources/windows/client/requests/AsyncMonitorRequest.d.ts +20 -0
- package/dist/serialization/resources/windows/client/requests/AsyncMonitorRequest.js +41 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPageQueryRequest.d.ts +20 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPageQueryRequest.js +41 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPaginatedExtractionRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPaginatedExtractionRequest.js +40 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPromptContentRequest.d.ts +20 -0
- package/dist/serialization/resources/windows/client/requests/AsyncPromptContentRequest.js +41 -0
- package/dist/serialization/resources/windows/client/requests/AsyncScreenshotRequest.d.ts +18 -0
- package/dist/serialization/resources/windows/client/requests/AsyncScreenshotRequest.js +39 -0
- package/dist/serialization/resources/windows/client/requests/AsyncSummarizeContentRequest.d.ts +19 -0
- package/dist/serialization/resources/windows/client/requests/AsyncSummarizeContentRequest.js +40 -0
- package/dist/serialization/resources/windows/client/requests/AsyncTypeRequest.d.ts +24 -0
- package/dist/serialization/resources/windows/client/requests/AsyncTypeRequest.js +45 -0
- package/dist/serialization/resources/windows/client/requests/SessionMonitorHandlerRequestBody.d.ts +18 -0
- package/dist/serialization/resources/windows/client/requests/SessionMonitorHandlerRequestBody.js +39 -0
- package/dist/serialization/resources/windows/client/requests/index.d.ts +10 -0
- package/dist/serialization/resources/windows/client/requests/index.js +21 -1
- package/dist/serialization/types/AsyncConfig.d.ts +12 -0
- package/dist/serialization/types/AsyncConfig.js +33 -0
- package/dist/serialization/types/AsyncSessionAiResponseEnvelope.d.ts +15 -0
- package/dist/serialization/types/AsyncSessionAiResponseEnvelope.js +36 -0
- package/dist/serialization/types/BrowserWaitSelectorConfig.d.ts +14 -0
- package/dist/serialization/types/BrowserWaitSelectorConfig.js +35 -0
- package/dist/serialization/types/IntervalMonitorConfig.d.ts +13 -0
- package/dist/serialization/types/IntervalMonitorConfig.js +34 -0
- package/dist/serialization/types/MonitorConfig.d.ts +19 -0
- package/dist/serialization/types/MonitorConfig.js +40 -0
- package/dist/serialization/types/MonitorConfigIncludeVisualAnalysis.d.ts +10 -0
- package/dist/serialization/types/MonitorConfigIncludeVisualAnalysis.js +31 -0
- package/dist/serialization/types/MonitorConfigMonitorType.d.ts +10 -0
- package/dist/serialization/types/MonitorConfigMonitorType.js +31 -0
- package/dist/serialization/types/RequestStatusResponse.d.ts +13 -0
- package/dist/serialization/types/RequestStatusResponse.js +34 -0
- package/dist/serialization/types/index.d.ts +8 -0
- package/dist/serialization/types/index.js +8 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/process-screenshots.d.ts +10 -0
- package/dist/utils/process-screenshots.js +59 -0
- package/dist/wrapper/AirtopWindows.d.ts +10 -0
- package/dist/wrapper/AirtopWindows.js +17 -0
- package/package.json +1 -1
- package/reference.md +768 -0
- 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/AsyncClickRequest.d.ts +20 -0
- package/serialization/resources/windows/client/requests/AsyncClickRequest.js +41 -0
- package/serialization/resources/windows/client/requests/AsyncHoverRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/AsyncHoverRequest.js +40 -0
- package/serialization/resources/windows/client/requests/AsyncMonitorRequest.d.ts +20 -0
- package/serialization/resources/windows/client/requests/AsyncMonitorRequest.js +41 -0
- package/serialization/resources/windows/client/requests/AsyncPageQueryRequest.d.ts +20 -0
- package/serialization/resources/windows/client/requests/AsyncPageQueryRequest.js +41 -0
- package/serialization/resources/windows/client/requests/AsyncPaginatedExtractionRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/AsyncPaginatedExtractionRequest.js +40 -0
- package/serialization/resources/windows/client/requests/AsyncPromptContentRequest.d.ts +20 -0
- package/serialization/resources/windows/client/requests/AsyncPromptContentRequest.js +41 -0
- package/serialization/resources/windows/client/requests/AsyncScreenshotRequest.d.ts +18 -0
- package/serialization/resources/windows/client/requests/AsyncScreenshotRequest.js +39 -0
- package/serialization/resources/windows/client/requests/AsyncSummarizeContentRequest.d.ts +19 -0
- package/serialization/resources/windows/client/requests/AsyncSummarizeContentRequest.js +40 -0
- package/serialization/resources/windows/client/requests/AsyncTypeRequest.d.ts +24 -0
- package/serialization/resources/windows/client/requests/AsyncTypeRequest.js +45 -0
- package/serialization/resources/windows/client/requests/SessionMonitorHandlerRequestBody.d.ts +18 -0
- package/serialization/resources/windows/client/requests/SessionMonitorHandlerRequestBody.js +39 -0
- package/serialization/resources/windows/client/requests/index.d.ts +10 -0
- package/serialization/resources/windows/client/requests/index.js +21 -1
- package/serialization/types/AsyncConfig.d.ts +12 -0
- package/serialization/types/AsyncConfig.js +33 -0
- package/serialization/types/AsyncSessionAiResponseEnvelope.d.ts +15 -0
- package/serialization/types/AsyncSessionAiResponseEnvelope.js +36 -0
- package/serialization/types/BrowserWaitSelectorConfig.d.ts +14 -0
- package/serialization/types/BrowserWaitSelectorConfig.js +35 -0
- package/serialization/types/IntervalMonitorConfig.d.ts +13 -0
- package/serialization/types/IntervalMonitorConfig.js +34 -0
- package/serialization/types/MonitorConfig.d.ts +19 -0
- package/serialization/types/MonitorConfig.js +40 -0
- package/serialization/types/MonitorConfigIncludeVisualAnalysis.d.ts +10 -0
- package/serialization/types/MonitorConfigIncludeVisualAnalysis.js +31 -0
- package/serialization/types/MonitorConfigMonitorType.d.ts +10 -0
- package/serialization/types/MonitorConfigMonitorType.js +31 -0
- package/serialization/types/RequestStatusResponse.d.ts +13 -0
- package/serialization/types/RequestStatusResponse.js +34 -0
- package/serialization/types/index.d.ts +8 -0
- package/serialization/types/index.js +8 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/process-screenshots.d.ts +10 -0
- package/utils/process-screenshots.js +59 -0
- package/wrapper/AirtopWindows.d.ts +10 -0
- package/wrapper/AirtopWindows.js +17 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.processScreenshots = void 0;
|
13
|
+
function extractMimeAndBase64(dataUrl) {
|
14
|
+
const match = dataUrl.match(/^data:(image\/\w+);base64,(.+)$/);
|
15
|
+
if (match) {
|
16
|
+
return { mimeType: match[1], base64Data: match[2] };
|
17
|
+
}
|
18
|
+
return {
|
19
|
+
mimeType: "image/jpeg",
|
20
|
+
base64Data: dataUrl.replace(/^data:image\/jpeg;base64,/, ""),
|
21
|
+
};
|
22
|
+
}
|
23
|
+
function processScreenshots(response) {
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
25
|
+
const screenshots = response.meta.screenshots;
|
26
|
+
if (!screenshots) {
|
27
|
+
return [];
|
28
|
+
}
|
29
|
+
const processedScreenshots = screenshots.map((screenshot, index) => {
|
30
|
+
if (!screenshot.dataUrl) {
|
31
|
+
return {
|
32
|
+
index,
|
33
|
+
error: new Error("Screenshot data URL not found"),
|
34
|
+
success: false,
|
35
|
+
};
|
36
|
+
}
|
37
|
+
try {
|
38
|
+
const { mimeType, base64Data } = extractMimeAndBase64(screenshot.dataUrl);
|
39
|
+
const binaryData = Buffer.from(base64Data, "base64");
|
40
|
+
return {
|
41
|
+
index,
|
42
|
+
binaryData,
|
43
|
+
mimeType,
|
44
|
+
success: true,
|
45
|
+
};
|
46
|
+
}
|
47
|
+
catch (err) {
|
48
|
+
console.error(`Error processing screenshot ${index}:`, err);
|
49
|
+
return {
|
50
|
+
index,
|
51
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
52
|
+
success: false,
|
53
|
+
};
|
54
|
+
}
|
55
|
+
});
|
56
|
+
return processedScreenshots;
|
57
|
+
});
|
58
|
+
}
|
59
|
+
exports.processScreenshots = processScreenshots;
|
@@ -114,6 +114,16 @@ export declare class AirtopWindows extends WindowsClass {
|
|
114
114
|
* })
|
115
115
|
*/
|
116
116
|
type(sessionId: string, windowId: string, request: Airtop.SessionTypeHandlerRequestBody, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.AiPromptResponse>;
|
117
|
+
/**
|
118
|
+
* @param {string} sessionId - The session id for the window.
|
119
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
120
|
+
* @param {Airtop.SessionMonitorHandlerRequestBody} request
|
121
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
122
|
+
*
|
123
|
+
* @example
|
124
|
+
* await client.windows.monitor("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
125
|
+
*/
|
126
|
+
monitor(sessionId: string, windowId: string, request?: Airtop.SessionMonitorHandlerRequestBody, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.AiPromptResponse>;
|
117
127
|
private executeSeleniumCDPCommand;
|
118
128
|
getWindowInfoForSeleniumDriver(session: Airtop.ExternalSessionWithConnectionInfo, driver: seleniumWebdriver.WebDriver, request?: Airtop.GetWindowInfoRequest, requestOptions?: WindowsNamespace.RequestOptions): Promise<Airtop.WindowResponse>;
|
119
129
|
}
|
package/wrapper/AirtopWindows.js
CHANGED
@@ -190,6 +190,23 @@ class AirtopWindows extends Client_1.Windows {
|
|
190
190
|
return _super.type.call(this, sessionId, windowId, request, Object.assign(Object.assign({ timeoutInSeconds: 600 }, requestOptions), { maxRetries: 0 }));
|
191
191
|
});
|
192
192
|
}
|
193
|
+
/**
|
194
|
+
* @param {string} sessionId - The session id for the window.
|
195
|
+
* @param {string} windowId - The Airtop window id of the browser window.
|
196
|
+
* @param {Airtop.SessionMonitorHandlerRequestBody} request
|
197
|
+
* @param {Windows.RequestOptions} requestOptions - Request-specific configuration.
|
198
|
+
*
|
199
|
+
* @example
|
200
|
+
* await client.windows.monitor("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a-91b0-42c5-6156-76a5eba87430")
|
201
|
+
*/
|
202
|
+
monitor(sessionId, windowId, request = {}, requestOptions) {
|
203
|
+
const _super = Object.create(null, {
|
204
|
+
monitor: { get: () => super.monitor }
|
205
|
+
});
|
206
|
+
return __awaiter(this, void 0, void 0, function* () {
|
207
|
+
return _super.monitor.call(this, sessionId, windowId, request, Object.assign(Object.assign({ timeoutInSeconds: 600 }, requestOptions), { maxRetries: 0 }));
|
208
|
+
});
|
209
|
+
}
|
193
210
|
executeSeleniumCDPCommand(driver, session, apiKey) {
|
194
211
|
return __awaiter(this, void 0, void 0, function* () {
|
195
212
|
// Get the current WebDriver session ID
|