@airtop/sdk 1.0.0-alpha2.34 → 1.0.0-alpha2.36
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/dist/index.cjs +22 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +22 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -9,7 +9,7 @@ var require_package = __commonJS({
|
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: "@airtop/sdk",
|
|
11
11
|
description: "Airtop SDK for TypeScript",
|
|
12
|
-
version: "1.0.0-alpha2.
|
|
12
|
+
version: "1.0.0-alpha2.36",
|
|
13
13
|
type: "module",
|
|
14
14
|
main: "./dist/index.cjs",
|
|
15
15
|
module: "./dist/index.js",
|
|
@@ -48,7 +48,7 @@ var require_package = __commonJS({
|
|
|
48
48
|
"verify-types": "tsc --noEmit && tsc --noEmit --project tsconfig.e2e.json"
|
|
49
49
|
},
|
|
50
50
|
dependencies: {
|
|
51
|
-
"@airtop/core": "0.1.0-alpha.
|
|
51
|
+
"@airtop/core": "0.1.0-alpha.45",
|
|
52
52
|
"@airtop/json-schema-adapter": "workspace:*",
|
|
53
53
|
"date-fns": "4.1.0",
|
|
54
54
|
loglayer: "6.7.0",
|
|
@@ -691,6 +691,8 @@ var AirtopWindowClient = class extends AirtopBase {
|
|
|
691
691
|
this.getWindowId(),
|
|
692
692
|
{
|
|
693
693
|
...config,
|
|
694
|
+
createDraftTestCase: true,
|
|
695
|
+
// Always create a draft test case from Stainless SDK
|
|
694
696
|
elementDescription,
|
|
695
697
|
sessionId: this.sessionId
|
|
696
698
|
},
|
|
@@ -726,6 +728,8 @@ var AirtopWindowClient = class extends AirtopBase {
|
|
|
726
728
|
{
|
|
727
729
|
elementDescription,
|
|
728
730
|
sessionId: this.sessionId,
|
|
731
|
+
createDraftTestCase: true,
|
|
732
|
+
// Always create a draft test case from Stainless SDK
|
|
729
733
|
...config || {}
|
|
730
734
|
},
|
|
731
735
|
{
|
|
@@ -815,6 +819,8 @@ var AirtopWindowClient = class extends AirtopBase {
|
|
|
815
819
|
{
|
|
816
820
|
sessionId: this.sessionId,
|
|
817
821
|
prompt,
|
|
822
|
+
createDraftTestCase: true,
|
|
823
|
+
// Always create a draft test case from Stainless SDK
|
|
818
824
|
...newConfig || {}
|
|
819
825
|
},
|
|
820
826
|
{
|
|
@@ -938,6 +944,8 @@ var AirtopWindowClient = class extends AirtopBase {
|
|
|
938
944
|
{
|
|
939
945
|
sessionId: this.sessionId,
|
|
940
946
|
text,
|
|
947
|
+
createDraftTestCase: true,
|
|
948
|
+
// Always create a draft test case from Stainless SDK
|
|
941
949
|
...config || {}
|
|
942
950
|
},
|
|
943
951
|
{
|
|
@@ -1404,11 +1412,12 @@ var AirtopSessionClient = class extends AirtopBase {
|
|
|
1404
1412
|
*
|
|
1405
1413
|
* @param configuration - The optional configuration parameters for the function
|
|
1406
1414
|
* @param configuration.lookbackSeconds - The number of seconds to look back for prior events. Default `5`. 0 means no lookback.
|
|
1415
|
+
* @param configuration.fileType - The file type to wait for, such as "browser_download". If provided, only files of this type will be considered.
|
|
1407
1416
|
* @param requestOptions - Optional request configuration including timeout
|
|
1408
1417
|
* @returns Object containing file's id and downloadUrl, or null if timed out
|
|
1409
1418
|
*/
|
|
1410
1419
|
async waitForDownload(configuration, requestOptions = {}) {
|
|
1411
|
-
const { lookbackSeconds = 5 } = configuration || {};
|
|
1420
|
+
const { lookbackSeconds = 5, fileType } = configuration || {};
|
|
1412
1421
|
this.log.info(`waiting for file to be available on session: ${this.sessionId}`);
|
|
1413
1422
|
const startTime = /* @__PURE__ */ new Date();
|
|
1414
1423
|
const timeoutSeconds = _optionalChain([requestOptions, 'optionalAccess', _19 => _19.timeoutInSeconds]) || 120;
|
|
@@ -1421,7 +1430,7 @@ var AirtopSessionClient = class extends AirtopBase {
|
|
|
1421
1430
|
const processEventsPromise = (async () => {
|
|
1422
1431
|
const sessionEvents = await this.client.sessions.getEvents(
|
|
1423
1432
|
this.sessionId,
|
|
1424
|
-
{ all: lookbackSeconds >= 0 },
|
|
1433
|
+
{ all: lookbackSeconds >= 0, reverse: true },
|
|
1425
1434
|
{ timeoutInSeconds: timeoutSeconds, ...requestOptions || {} }
|
|
1426
1435
|
);
|
|
1427
1436
|
for await (const event of sessionEvents) {
|
|
@@ -1431,16 +1440,22 @@ var AirtopSessionClient = class extends AirtopBase {
|
|
|
1431
1440
|
const eventTime = Date.parse(e.eventTime);
|
|
1432
1441
|
this.log.info(`file_status message received:
|
|
1433
1442
|
${JSON.stringify(event, null, 2)}`);
|
|
1443
|
+
if (fileType && e.type !== fileType) {
|
|
1444
|
+
this.log.info(`skipping file of type ${e.type} (looking for ${fileType})`);
|
|
1445
|
+
continue;
|
|
1446
|
+
}
|
|
1434
1447
|
const thresholdTime = startTime.getTime() - lookbackSeconds * 1e3;
|
|
1435
1448
|
if (eventTime < thresholdTime) {
|
|
1436
1449
|
this.log.info(
|
|
1437
|
-
`
|
|
1450
|
+
`stopping event processing - encountered event older than lookbackSeconds threshold`
|
|
1438
1451
|
);
|
|
1439
|
-
|
|
1452
|
+
break;
|
|
1440
1453
|
}
|
|
1441
1454
|
return {
|
|
1442
1455
|
id: e.fileId,
|
|
1443
|
-
downloadUrl: e.downloadUrl
|
|
1456
|
+
downloadUrl: e.downloadUrl,
|
|
1457
|
+
fileName: e.name,
|
|
1458
|
+
fileType: e.type
|
|
1444
1459
|
};
|
|
1445
1460
|
}
|
|
1446
1461
|
}
|