@airtop/sdk 0.1.8 → 0.1.11

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 +2 -3
  50. package/dist/utils/batch-operate/WindowQueue.d.ts +2 -3
  51. package/dist/utils/batch-operate/batch-util.d.ts +1 -1
  52. package/dist/utils/batch-operate/batch-util.js +2 -4
  53. package/dist/utils/batch-operate/types.d.ts +1 -1
  54. package/dist/wrapper/AirtopClient.d.ts +2 -0
  55. package/dist/wrapper/AirtopClient.js +36 -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 +2 -3
  71. package/utils/batch-operate/WindowQueue.d.ts +2 -3
  72. package/utils/batch-operate/batch-util.d.ts +1 -1
  73. package/utils/batch-operate/batch-util.js +2 -4
  74. package/utils/batch-operate/types.d.ts +1 -1
  75. package/wrapper/AirtopClient.d.ts +2 -0
  76. package/wrapper/AirtopClient.js +36 -0
@@ -6,5 +6,5 @@ import * as Airtop from "../../api/index";
6
6
  import * as core from "../../core";
7
7
  export declare const StatusMessageStatus: core.serialization.Schema<serializers.StatusMessageStatus.Raw, Airtop.StatusMessageStatus>;
8
8
  export declare namespace StatusMessageStatus {
9
- type Raw = "awaitingCapacity" | "initializing" | "running" | "ended";
9
+ type Raw = "awaitingCapacity" | "initializing" | "running" | "ended" | "error" | "disconnected";
10
10
  }
@@ -28,4 +28,4 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.StatusMessageStatus = void 0;
30
30
  const core = __importStar(require("../../core"));
31
- exports.StatusMessageStatus = core.serialization.enum_(["awaitingCapacity", "initializing", "running", "ended"]);
31
+ exports.StatusMessageStatus = core.serialization.enum_(["awaitingCapacity", "initializing", "running", "ended", "error", "disconnected"]);
@@ -17,6 +17,7 @@ export * from "./OperationOutcome";
17
17
  export * from "./OperationOutcomeResponse";
18
18
  export * from "./PageQueryConfig";
19
19
  export * from "./PageQueryExperimentalConfig";
20
+ export * from "./PaginatedExtractionConfig";
20
21
  export * from "./Pagination";
21
22
  export * from "./ProfilesResponse";
22
23
  export * from "./ScrapeResponse";
@@ -33,6 +33,7 @@ __exportStar(require("./OperationOutcome"), exports);
33
33
  __exportStar(require("./OperationOutcomeResponse"), exports);
34
34
  __exportStar(require("./PageQueryConfig"), exports);
35
35
  __exportStar(require("./PageQueryExperimentalConfig"), exports);
36
+ __exportStar(require("./PaginatedExtractionConfig"), exports);
36
37
  __exportStar(require("./Pagination"), exports);
37
38
  __exportStar(require("./ProfilesResponse"), exports);
38
39
  __exportStar(require("./ScrapeResponse"), exports);
@@ -1,7 +1,6 @@
1
- /// <reference types="node" />
2
- import type { AirtopClient } from "wrapper/AirtopClient";
1
+ import type { AirtopClient } from "../../wrapper/AirtopClient";
3
2
  import type { BatchOperationError, BatchOperationInput, BatchOperationResponse, BatchOperationUrl } from "./types";
4
- import type { EventEmitter } from "node:events";
3
+ import type { EventEmitter } from "eventemitter3";
5
4
  import type { AirtopSessionConfigV1 } from "wrapper/AirtopSessions";
6
5
  export declare class SessionQueue<T> {
7
6
  private activePromises;
@@ -1,7 +1,6 @@
1
- /// <reference types="node" />
2
- import type { AirtopClient } from "wrapper/AirtopClient";
1
+ import type { AirtopClient } from "../../wrapper/AirtopClient";
3
2
  import type { BatchOperationError, BatchOperationInput, BatchOperationResponse, BatchOperationUrl } from "./types";
4
- import type { EventEmitter } from "node:events";
3
+ import type { EventEmitter } from "eventemitter3";
5
4
  export declare class WindowQueue<T> {
6
5
  private activePromises;
7
6
  private urlQueue;
@@ -1,3 +1,3 @@
1
- import type { AirtopClient } from "wrapper/AirtopClient";
1
+ import type { AirtopClient } from "../../wrapper/AirtopClient";
2
2
  import type { BatchOperateConfig, BatchOperationInput, BatchOperationResponse, BatchOperationUrl } from "./types";
3
3
  export declare const batchOperate: <T>(urls: BatchOperationUrl[], operation: (input: BatchOperationInput) => Promise<BatchOperationResponse<T>>, client: AirtopClient, config?: BatchOperateConfig | undefined) => Promise<T[]>;
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.batchOperate = void 0;
13
- const node_events_1 = require("node:events");
13
+ const eventemitter3_1 = require("eventemitter3");
14
14
  const helpers_1 = require("./helpers");
15
15
  const SessionQueue_1 = require("./SessionQueue");
16
16
  const DEFAULT_MAX_WINDOWS_PER_SESSION = 1;
@@ -26,10 +26,8 @@ client, config) => __awaiter(void 0, void 0, void 0, function* () {
26
26
  throw new Error("Please provide a valid list of urls");
27
27
  }
28
28
  }
29
- const runEmitter = new node_events_1.EventEmitter();
29
+ const runEmitter = new eventemitter3_1.EventEmitter();
30
30
  const { maxConcurrentSessions = DEFAULT_MAX_CONCURRENT_SESSIONS, maxWindowsPerSession = DEFAULT_MAX_WINDOWS_PER_SESSION, sessionConfig, onError, } = config !== null && config !== void 0 ? config : {};
31
- // Set the maximum number of listeners to accommodate all concurrent sessions and windows
32
- runEmitter.setMaxListeners(maxConcurrentSessions + (maxConcurrentSessions * maxWindowsPerSession) + 1);
33
31
  // Split the urls into batches
34
32
  const initialBatches = (0, helpers_1.distributeUrlsToBatches)(urls, maxConcurrentSessions);
35
33
  const sessionQueue = new SessionQueue_1.SessionQueue({
@@ -1,4 +1,4 @@
1
- import type { AirtopSessionConfigV1 } from "wrapper/AirtopSessions";
1
+ import type { AirtopSessionConfigV1 } from "../../wrapper/AirtopSessions";
2
2
  export declare type BatchOperateConfig = {
3
3
  maxConcurrentSessions?: number;
4
4
  maxWindowsPerSession?: number;
@@ -12,6 +12,8 @@ export declare class AirtopClient {
12
12
  private _windows;
13
13
  private _sessions;
14
14
  constructor(_options: AugmentedOptions);
15
+ setApiKey(apiKey: string): void;
16
+ setEnvironment(environment: string): void;
15
17
  get sessions(): AirtopSessions;
16
18
  get windows(): AirtopWindows;
17
19
  get profiles(): import("../api/resources/profiles/client/Client").Profiles;
@@ -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)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airtop/sdk",
3
- "version": "0.1.8",
3
+ "version": "0.1.11",
4
4
  "private": false,
5
5
  "repository": "https://github.com/airtop-ai/airtop-node-sdk",
6
6
  "main": "./index.js",
@@ -19,7 +19,8 @@
19
19
  "node-fetch": "2.7.0",
20
20
  "qs": "6.11.2",
21
21
  "js-base64": "3.7.2",
22
- "async-mutex": "0.5.0"
22
+ "async-mutex": "0.5.0",
23
+ "eventemitter3": "5.0.1"
23
24
  },
24
25
  "devDependencies": {
25
26
  "@types/url-join": "4.0.1",
package/reference.md CHANGED
@@ -442,6 +442,73 @@ await client.windows.pageQuery("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "0334da2a
442
442
  </dl>
443
443
  </details>
444
444
 
445
+ <details><summary><code>client.windows.<a href="/src/api/resources/windows/client/Client.ts">paginatedExtraction</a>(sessionId, windowId, { ...params }) -> Airtop.AiPromptResponse</code></summary>
446
+ <dl>
447
+ <dd>
448
+
449
+ #### 🔌 Usage
450
+
451
+ <dl>
452
+ <dd>
453
+
454
+ <dl>
455
+ <dd>
456
+
457
+ ```typescript
458
+ await client.windows.paginatedExtraction(
459
+ "6aac6f73-bd89-4a76-ab32-5a6c422e8b0b",
460
+ "0334da2a-91b0-42c5-6156-76a5eba87430"
461
+ );
462
+ ```
463
+
464
+ </dd>
465
+ </dl>
466
+ </dd>
467
+ </dl>
468
+
469
+ #### ⚙️ Parameters
470
+
471
+ <dl>
472
+ <dd>
473
+
474
+ <dl>
475
+ <dd>
476
+
477
+ **sessionId:** `string` — The session id for the window.
478
+
479
+ </dd>
480
+ </dl>
481
+
482
+ <dl>
483
+ <dd>
484
+
485
+ **windowId:** `string` — The Airtop window id of the browser window.
486
+
487
+ </dd>
488
+ </dl>
489
+
490
+ <dl>
491
+ <dd>
492
+
493
+ **request:** `Airtop.SessionPaginatedExtractionHandlerRequestBody`
494
+
495
+ </dd>
496
+ </dl>
497
+
498
+ <dl>
499
+ <dd>
500
+
501
+ **requestOptions:** `Windows.RequestOptions`
502
+
503
+ </dd>
504
+ </dl>
505
+ </dd>
506
+ </dl>
507
+
508
+ </dd>
509
+ </dl>
510
+ </details>
511
+
445
512
  <details><summary><code>client.windows.<a href="/src/api/resources/windows/client/Client.ts">promptContent</a>(sessionId, windowId, { ...params }) -> Airtop.AiPromptResponse</code></summary>
446
513
  <dl>
447
514
  <dd>
@@ -1102,11 +1169,11 @@ await client.sessions.terminate("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b");
1102
1169
  </dl>
1103
1170
  </details>
1104
1171
 
1105
- <details><summary><code>client.sessions.<a href="/src/api/resources/sessions/client/Client.ts">events</a>(id) -> core.Stream<Airtop.SessionsEventsResponse></code></summary>
1172
+ <details><summary><code>client.sessions.<a href="/src/api/resources/sessions/client/Client.ts">saveProfileOnTermination</a>(sessionId, profileName) -> void</code></summary>
1106
1173
  <dl>
1107
1174
  <dd>
1108
1175
 
1109
- #### 📝 Description
1176
+ #### 🔌 Usage
1110
1177
 
1111
1178
  <dl>
1112
1179
  <dd>
@@ -1114,14 +1181,16 @@ await client.sessions.terminate("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b");
1114
1181
  <dl>
1115
1182
  <dd>
1116
1183
 
1117
- Get a session event stream for a given session ID
1184
+ ```typescript
1185
+ await client.sessions.saveProfileOnTermination("6aac6f73-bd89-4a76-ab32-5a6c422e8b0b", "myProfile");
1186
+ ```
1118
1187
 
1119
1188
  </dd>
1120
1189
  </dl>
1121
1190
  </dd>
1122
1191
  </dl>
1123
1192
 
1124
- #### 🔌 Usage
1193
+ #### ⚙️ Parameters
1125
1194
 
1126
1195
  <dl>
1127
1196
  <dd>
@@ -1129,24 +1198,15 @@ Get a session event stream for a given session ID
1129
1198
  <dl>
1130
1199
  <dd>
1131
1200
 
1132
- ```typescript
1133
- await client.sessions.events("string");
1134
- ```
1201
+ **sessionId:** `string` — ID of the session that owns the window.
1135
1202
 
1136
1203
  </dd>
1137
1204
  </dl>
1138
- </dd>
1139
- </dl>
1140
-
1141
- #### ⚙️ Parameters
1142
-
1143
- <dl>
1144
- <dd>
1145
1205
 
1146
1206
  <dl>
1147
1207
  <dd>
1148
1208
 
1149
- **id:** `string` — ID of the session to get status info for
1209
+ **profileName:** `string` — Name under which to save the profile.
1150
1210
 
1151
1211
  </dd>
1152
1212
  </dl>
@@ -0,0 +1,17 @@
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 { PaginatedExtractionConfig } from "../../../../types/PaginatedExtractionConfig";
8
+ export declare const SessionPaginatedExtractionHandlerRequestBody: core.serialization.Schema<serializers.SessionPaginatedExtractionHandlerRequestBody.Raw, Airtop.SessionPaginatedExtractionHandlerRequestBody>;
9
+ export declare namespace SessionPaginatedExtractionHandlerRequestBody {
10
+ interface Raw {
11
+ clientRequestId?: string | null;
12
+ configuration?: PaginatedExtractionConfig.Raw | null;
13
+ costThresholdCredits?: number | null;
14
+ prompt?: string | null;
15
+ timeThresholdSeconds?: number | null;
16
+ }
17
+ }
@@ -0,0 +1,38 @@
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 (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.SessionPaginatedExtractionHandlerRequestBody = void 0;
30
+ const core = __importStar(require("../../../../../core"));
31
+ const PaginatedExtractionConfig_1 = require("../../../../types/PaginatedExtractionConfig");
32
+ exports.SessionPaginatedExtractionHandlerRequestBody = core.serialization.object({
33
+ clientRequestId: core.serialization.string().optional(),
34
+ configuration: PaginatedExtractionConfig_1.PaginatedExtractionConfig.optional(),
35
+ costThresholdCredits: core.serialization.number().optional(),
36
+ prompt: core.serialization.string().optional(),
37
+ timeThresholdSeconds: core.serialization.number().optional(),
38
+ });
@@ -2,6 +2,7 @@ export { CreateWindowInputV1Body } from "./CreateWindowInputV1Body";
2
2
  export { WindowLoadUrlV1Body } from "./WindowLoadUrlV1Body";
3
3
  export { SessionClickHandlerRequestBody } from "./SessionClickHandlerRequestBody";
4
4
  export { SessionHoverHandlerRequestBody } from "./SessionHoverHandlerRequestBody";
5
+ export { SessionPaginatedExtractionHandlerRequestBody } from "./SessionPaginatedExtractionHandlerRequestBody";
5
6
  export { ScrapeContentRequest } from "./ScrapeContentRequest";
6
7
  export { SessionSummaryHandlerRequestBody } from "./SessionSummaryHandlerRequestBody";
7
8
  export { SessionTypeHandlerRequestBody } from "./SessionTypeHandlerRequestBody";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SessionTypeHandlerRequestBody = exports.SessionSummaryHandlerRequestBody = exports.ScrapeContentRequest = exports.SessionHoverHandlerRequestBody = exports.SessionClickHandlerRequestBody = exports.WindowLoadUrlV1Body = exports.CreateWindowInputV1Body = void 0;
3
+ exports.SessionTypeHandlerRequestBody = exports.SessionSummaryHandlerRequestBody = exports.ScrapeContentRequest = exports.SessionPaginatedExtractionHandlerRequestBody = exports.SessionHoverHandlerRequestBody = exports.SessionClickHandlerRequestBody = exports.WindowLoadUrlV1Body = exports.CreateWindowInputV1Body = void 0;
4
4
  var CreateWindowInputV1Body_1 = require("./CreateWindowInputV1Body");
5
5
  Object.defineProperty(exports, "CreateWindowInputV1Body", { enumerable: true, get: function () { return CreateWindowInputV1Body_1.CreateWindowInputV1Body; } });
6
6
  var WindowLoadUrlV1Body_1 = require("./WindowLoadUrlV1Body");
@@ -9,6 +9,8 @@ var SessionClickHandlerRequestBody_1 = require("./SessionClickHandlerRequestBody
9
9
  Object.defineProperty(exports, "SessionClickHandlerRequestBody", { enumerable: true, get: function () { return SessionClickHandlerRequestBody_1.SessionClickHandlerRequestBody; } });
10
10
  var SessionHoverHandlerRequestBody_1 = require("./SessionHoverHandlerRequestBody");
11
11
  Object.defineProperty(exports, "SessionHoverHandlerRequestBody", { enumerable: true, get: function () { return SessionHoverHandlerRequestBody_1.SessionHoverHandlerRequestBody; } });
12
+ var SessionPaginatedExtractionHandlerRequestBody_1 = require("./SessionPaginatedExtractionHandlerRequestBody");
13
+ Object.defineProperty(exports, "SessionPaginatedExtractionHandlerRequestBody", { enumerable: true, get: function () { return SessionPaginatedExtractionHandlerRequestBody_1.SessionPaginatedExtractionHandlerRequestBody; } });
12
14
  var ScrapeContentRequest_1 = require("./ScrapeContentRequest");
13
15
  Object.defineProperty(exports, "ScrapeContentRequest", { enumerable: true, get: function () { return ScrapeContentRequest_1.ScrapeContentRequest; } });
14
16
  var SessionSummaryHandlerRequestBody_1 = require("./SessionSummaryHandlerRequestBody");
@@ -0,0 +1,14 @@
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 PaginatedExtractionConfig: core.serialization.ObjectSchema<serializers.PaginatedExtractionConfig.Raw, Airtop.PaginatedExtractionConfig>;
8
+ export declare namespace PaginatedExtractionConfig {
9
+ interface Raw {
10
+ interactionMode?: string | null;
11
+ outputSchema?: string | null;
12
+ paginationMode?: string | null;
13
+ }
14
+ }
@@ -0,0 +1,35 @@
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 (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.PaginatedExtractionConfig = void 0;
30
+ const core = __importStar(require("../../core"));
31
+ exports.PaginatedExtractionConfig = core.serialization.object({
32
+ interactionMode: core.serialization.string().optional(),
33
+ outputSchema: core.serialization.string().optional(),
34
+ paginationMode: core.serialization.string().optional(),
35
+ });
@@ -9,6 +9,7 @@ export declare const SessionConfigV1: core.serialization.ObjectSchema<serializer
9
9
  export declare namespace SessionConfigV1 {
10
10
  interface Raw {
11
11
  baseProfileId?: string | null;
12
+ extensionIds?: string[] | null;
12
13
  persistProfile?: boolean | null;
13
14
  proxy?: SessionConfigV1Proxy.Raw | null;
14
15
  timeoutMinutes?: number | null;
@@ -31,6 +31,7 @@ const core = __importStar(require("../../core"));
31
31
  const SessionConfigV1Proxy_1 = require("./SessionConfigV1Proxy");
32
32
  exports.SessionConfigV1 = core.serialization.object({
33
33
  baseProfileId: core.serialization.string().optional(),
34
+ extensionIds: core.serialization.list(core.serialization.string()).optional(),
34
35
  persistProfile: core.serialization.boolean().optional(),
35
36
  proxy: SessionConfigV1Proxy_1.SessionConfigV1Proxy.optional(),
36
37
  timeoutMinutes: core.serialization.number().optional(),
@@ -6,5 +6,5 @@ import * as Airtop from "../../api/index";
6
6
  import * as core from "../../core";
7
7
  export declare const StatusMessageStatus: core.serialization.Schema<serializers.StatusMessageStatus.Raw, Airtop.StatusMessageStatus>;
8
8
  export declare namespace StatusMessageStatus {
9
- type Raw = "awaitingCapacity" | "initializing" | "running" | "ended";
9
+ type Raw = "awaitingCapacity" | "initializing" | "running" | "ended" | "error" | "disconnected";
10
10
  }
@@ -28,4 +28,4 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.StatusMessageStatus = void 0;
30
30
  const core = __importStar(require("../../core"));
31
- exports.StatusMessageStatus = core.serialization.enum_(["awaitingCapacity", "initializing", "running", "ended"]);
31
+ exports.StatusMessageStatus = core.serialization.enum_(["awaitingCapacity", "initializing", "running", "ended", "error", "disconnected"]);
@@ -17,6 +17,7 @@ export * from "./OperationOutcome";
17
17
  export * from "./OperationOutcomeResponse";
18
18
  export * from "./PageQueryConfig";
19
19
  export * from "./PageQueryExperimentalConfig";
20
+ export * from "./PaginatedExtractionConfig";
20
21
  export * from "./Pagination";
21
22
  export * from "./ProfilesResponse";
22
23
  export * from "./ScrapeResponse";
@@ -33,6 +33,7 @@ __exportStar(require("./OperationOutcome"), exports);
33
33
  __exportStar(require("./OperationOutcomeResponse"), exports);
34
34
  __exportStar(require("./PageQueryConfig"), exports);
35
35
  __exportStar(require("./PageQueryExperimentalConfig"), exports);
36
+ __exportStar(require("./PaginatedExtractionConfig"), exports);
36
37
  __exportStar(require("./Pagination"), exports);
37
38
  __exportStar(require("./ProfilesResponse"), exports);
38
39
  __exportStar(require("./ScrapeResponse"), exports);
@@ -1,7 +1,6 @@
1
- /// <reference types="node" />
2
- import type { AirtopClient } from "wrapper/AirtopClient";
1
+ import type { AirtopClient } from "../../wrapper/AirtopClient";
3
2
  import type { BatchOperationError, BatchOperationInput, BatchOperationResponse, BatchOperationUrl } from "./types";
4
- import type { EventEmitter } from "node:events";
3
+ import type { EventEmitter } from "eventemitter3";
5
4
  import type { AirtopSessionConfigV1 } from "wrapper/AirtopSessions";
6
5
  export declare class SessionQueue<T> {
7
6
  private activePromises;
@@ -1,7 +1,6 @@
1
- /// <reference types="node" />
2
- import type { AirtopClient } from "wrapper/AirtopClient";
1
+ import type { AirtopClient } from "../../wrapper/AirtopClient";
3
2
  import type { BatchOperationError, BatchOperationInput, BatchOperationResponse, BatchOperationUrl } from "./types";
4
- import type { EventEmitter } from "node:events";
3
+ import type { EventEmitter } from "eventemitter3";
5
4
  export declare class WindowQueue<T> {
6
5
  private activePromises;
7
6
  private urlQueue;
@@ -1,3 +1,3 @@
1
- import type { AirtopClient } from "wrapper/AirtopClient";
1
+ import type { AirtopClient } from "../../wrapper/AirtopClient";
2
2
  import type { BatchOperateConfig, BatchOperationInput, BatchOperationResponse, BatchOperationUrl } from "./types";
3
3
  export declare const batchOperate: <T>(urls: BatchOperationUrl[], operation: (input: BatchOperationInput) => Promise<BatchOperationResponse<T>>, client: AirtopClient, config?: BatchOperateConfig | undefined) => Promise<T[]>;
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.batchOperate = void 0;
13
- const node_events_1 = require("node:events");
13
+ const eventemitter3_1 = require("eventemitter3");
14
14
  const helpers_1 = require("./helpers");
15
15
  const SessionQueue_1 = require("./SessionQueue");
16
16
  const DEFAULT_MAX_WINDOWS_PER_SESSION = 1;
@@ -26,10 +26,8 @@ client, config) => __awaiter(void 0, void 0, void 0, function* () {
26
26
  throw new Error("Please provide a valid list of urls");
27
27
  }
28
28
  }
29
- const runEmitter = new node_events_1.EventEmitter();
29
+ const runEmitter = new eventemitter3_1.EventEmitter();
30
30
  const { maxConcurrentSessions = DEFAULT_MAX_CONCURRENT_SESSIONS, maxWindowsPerSession = DEFAULT_MAX_WINDOWS_PER_SESSION, sessionConfig, onError, } = config !== null && config !== void 0 ? config : {};
31
- // Set the maximum number of listeners to accommodate all concurrent sessions and windows
32
- runEmitter.setMaxListeners(maxConcurrentSessions + (maxConcurrentSessions * maxWindowsPerSession) + 1);
33
31
  // Split the urls into batches
34
32
  const initialBatches = (0, helpers_1.distributeUrlsToBatches)(urls, maxConcurrentSessions);
35
33
  const sessionQueue = new SessionQueue_1.SessionQueue({
@@ -1,4 +1,4 @@
1
- import type { AirtopSessionConfigV1 } from "wrapper/AirtopSessions";
1
+ import type { AirtopSessionConfigV1 } from "../../wrapper/AirtopSessions";
2
2
  export declare type BatchOperateConfig = {
3
3
  maxConcurrentSessions?: number;
4
4
  maxWindowsPerSession?: number;
@@ -12,6 +12,8 @@ export declare class AirtopClient {
12
12
  private _windows;
13
13
  private _sessions;
14
14
  constructor(_options: AugmentedOptions);
15
+ setApiKey(apiKey: string): void;
16
+ setEnvironment(environment: string): void;
15
17
  get sessions(): AirtopSessions;
16
18
  get windows(): AirtopWindows;
17
19
  get profiles(): import("../api/resources/profiles/client/Client").Profiles;
@@ -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)));