@airtop/plugin-playwright 1.0.0-alpha2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Airtop
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs ADDED
@@ -0,0 +1,25 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/index.ts
2
+ var _sdk = require('@airtop/sdk');
3
+ var plugin = {
4
+ augmentationType: _sdk.AirtopPluginAugmentationType.AirtopSessionClient,
5
+ augment: (prototype) => {
6
+ prototype.getWindowInfoForPlaywrightPage = async function(page, options, requestOptions) {
7
+ const cdpSession = await page.context().newCDPSession(page);
8
+ const { targetInfo } = await cdpSession.send("Target.getTargetInfo");
9
+ const targetId = targetInfo.targetId;
10
+ if (!targetId) {
11
+ throw new Error("TargetId not found");
12
+ }
13
+ return await this.withWindowId(targetId).getWindowInfo(options, requestOptions);
14
+ };
15
+ }
16
+ };
17
+ function playwrightPlugin() {
18
+ return {
19
+ pluginsToAdd: [plugin]
20
+ };
21
+ }
22
+
23
+
24
+ exports.playwrightPlugin = playwrightPlugin;
25
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/theo/projects/monarch/sdk-v2/wrapper-sdks/typescript/packages/plugins/playwright/dist/index.cjs","../src/index.ts"],"names":[],"mappings":"AAAA;ACAA,kCAA6C;AA4C7C,IAAM,OAAA,EAAoC;AAAA,EACxC,gBAAA,EAAkB,iCAAA,CAA6B,mBAAA;AAAA,EAC/C,OAAA,EAAS,CAAC,SAAA,EAAA,GAAoD;AAC5D,IAAA,SAAA,CAAU,+BAAA,EAAiC,MAAA,QAAA,CACzC,IAAA,EACA,OAAA,EACA,cAAA,EACA;AACA,MAAA,MAAM,WAAA,EAAa,MAAM,IAAA,CAAK,OAAA,CAAQ,CAAA,CAAE,aAAA,CAAc,IAAI,CAAA;AAC1D,MAAA,MAAM,EAAE,WAAW,EAAA,EAAI,MAAM,UAAA,CAAW,IAAA,CAAK,sBAAsB,CAAA;AACnE,MAAA,MAAM,SAAA,EAAW,UAAA,CAAW,QAAA;AAC5B,MAAA,GAAA,CAAI,CAAC,QAAA,EAAU;AACb,QAAA,MAAM,IAAI,KAAA,CAAM,oBAAoB,CAAA;AAAA,MACtC;AAEA,MAAA,OAAO,MAAM,IAAA,CAAK,YAAA,CAAa,QAAQ,CAAA,CAAE,aAAA,CAAc,OAAA,EAAS,cAAc,CAAA;AAAA,IAChF,CAAA;AAAA,EACF;AACF,CAAA;AAKO,SAAS,gBAAA,CAAA,EAA6C;AAC3D,EAAA,OAAO;AAAA,IACL,YAAA,EAAc,CAAC,MAAM;AAAA,EACvB,CAAA;AACF;ADlDA;AACE;AACF,4CAAC","file":"/Users/theo/projects/monarch/sdk-v2/wrapper-sdks/typescript/packages/plugins/playwright/dist/index.cjs","sourcesContent":[null,"import { AirtopPluginAugmentationType } from \"@airtop/sdk\";\nimport type { AirtopSessionClient, AirtopSessionClientPlugin } from \"@airtop/sdk\";\nimport type { AirtopRequestOptions } from \"@airtop/sdk\";\nimport type { AirtopWindow } from \"@airtop/sdk\";\nimport type { WindowGetConfig } from \"@airtop/sdk\";\nimport type { AirtopPluginRegistration } from \"@airtop/sdk\";\nimport type { AirtopWindowGetInfoResponse } from \"@airtop/sdk\";\nimport type { Page } from \"playwright\";\n\n// This is exported so the docs can expose it as we can't generate docs against the\n// module declaration\n/**\n * The methods provided by the Playwright plugin.\n */\nexport interface PlaywrightPluginMethods {\n /**\n * Get the window information for a Playwright Page instance.\n * @param page The Playwright Page instance to get window information for.\n * @param options Configuration options for the window info request.\n * @param requestOptions Additional options to customize the request behavior.\n */\n getWindowInfoForPlaywrightPage(\n page: Page,\n options?: WindowGetConfig,\n requestOptions?: AirtopRequestOptions,\n ): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;\n}\n\ndeclare module \"@airtop/sdk\" {\n interface AirtopSessionClient {\n /**\n * Get the window information for a Playwright Page instance.\n * @param page The Playwright Page instance to get window information for.\n * @param options Configuration options for the window info request.\n * @param requestOptions Additional options to customize the request behavior.\n */\n getWindowInfoForPlaywrightPage(\n page: Page,\n options?: WindowGetConfig,\n requestOptions?: AirtopRequestOptions,\n ): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;\n }\n}\n\nconst plugin: AirtopSessionClientPlugin = {\n augmentationType: AirtopPluginAugmentationType.AirtopSessionClient,\n augment: (prototype: typeof AirtopSessionClient.prototype) => {\n prototype.getWindowInfoForPlaywrightPage = async function (\n page: Page,\n options: WindowGetConfig,\n requestOptions: AirtopRequestOptions,\n ) {\n const cdpSession = await page.context().newCDPSession(page);\n const { targetInfo } = await cdpSession.send(\"Target.getTargetInfo\");\n const targetId = targetInfo.targetId;\n if (!targetId) {\n throw new Error(\"TargetId not found\");\n }\n\n return await this.withWindowId(targetId).getWindowInfo(options, requestOptions);\n };\n },\n};\n\n/**\n * Use with registerAirtopPlugin() from the Airtop SDK to add the Playwright plugin.\n */\nexport function playwrightPlugin(): AirtopPluginRegistration {\n return {\n pluginsToAdd: [plugin],\n };\n}\n"]}
@@ -0,0 +1,32 @@
1
+ import { WindowGetConfig, AirtopRequestOptions, AirtopWindow, AirtopWindowGetInfoResponse, AirtopPluginRegistration } from '@airtop/sdk';
2
+ import { Page } from 'playwright';
3
+
4
+ /**
5
+ * The methods provided by the Playwright plugin.
6
+ */
7
+ interface PlaywrightPluginMethods {
8
+ /**
9
+ * Get the window information for a Playwright Page instance.
10
+ * @param page The Playwright Page instance to get window information for.
11
+ * @param options Configuration options for the window info request.
12
+ * @param requestOptions Additional options to customize the request behavior.
13
+ */
14
+ getWindowInfoForPlaywrightPage(page: Page, options?: WindowGetConfig, requestOptions?: AirtopRequestOptions): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;
15
+ }
16
+ declare module "@airtop/sdk" {
17
+ interface AirtopSessionClient {
18
+ /**
19
+ * Get the window information for a Playwright Page instance.
20
+ * @param page The Playwright Page instance to get window information for.
21
+ * @param options Configuration options for the window info request.
22
+ * @param requestOptions Additional options to customize the request behavior.
23
+ */
24
+ getWindowInfoForPlaywrightPage(page: Page, options?: WindowGetConfig, requestOptions?: AirtopRequestOptions): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;
25
+ }
26
+ }
27
+ /**
28
+ * Use with registerAirtopPlugin() from the Airtop SDK to add the Playwright plugin.
29
+ */
30
+ declare function playwrightPlugin(): AirtopPluginRegistration;
31
+
32
+ export { type PlaywrightPluginMethods, playwrightPlugin };
@@ -0,0 +1,32 @@
1
+ import { WindowGetConfig, AirtopRequestOptions, AirtopWindow, AirtopWindowGetInfoResponse, AirtopPluginRegistration } from '@airtop/sdk';
2
+ import { Page } from 'playwright';
3
+
4
+ /**
5
+ * The methods provided by the Playwright plugin.
6
+ */
7
+ interface PlaywrightPluginMethods {
8
+ /**
9
+ * Get the window information for a Playwright Page instance.
10
+ * @param page The Playwright Page instance to get window information for.
11
+ * @param options Configuration options for the window info request.
12
+ * @param requestOptions Additional options to customize the request behavior.
13
+ */
14
+ getWindowInfoForPlaywrightPage(page: Page, options?: WindowGetConfig, requestOptions?: AirtopRequestOptions): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;
15
+ }
16
+ declare module "@airtop/sdk" {
17
+ interface AirtopSessionClient {
18
+ /**
19
+ * Get the window information for a Playwright Page instance.
20
+ * @param page The Playwright Page instance to get window information for.
21
+ * @param options Configuration options for the window info request.
22
+ * @param requestOptions Additional options to customize the request behavior.
23
+ */
24
+ getWindowInfoForPlaywrightPage(page: Page, options?: WindowGetConfig, requestOptions?: AirtopRequestOptions): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;
25
+ }
26
+ }
27
+ /**
28
+ * Use with registerAirtopPlugin() from the Airtop SDK to add the Playwright plugin.
29
+ */
30
+ declare function playwrightPlugin(): AirtopPluginRegistration;
31
+
32
+ export { type PlaywrightPluginMethods, playwrightPlugin };
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ // src/index.ts
2
+ import { AirtopPluginAugmentationType } from "@airtop/sdk";
3
+ var plugin = {
4
+ augmentationType: AirtopPluginAugmentationType.AirtopSessionClient,
5
+ augment: (prototype) => {
6
+ prototype.getWindowInfoForPlaywrightPage = async function(page, options, requestOptions) {
7
+ const cdpSession = await page.context().newCDPSession(page);
8
+ const { targetInfo } = await cdpSession.send("Target.getTargetInfo");
9
+ const targetId = targetInfo.targetId;
10
+ if (!targetId) {
11
+ throw new Error("TargetId not found");
12
+ }
13
+ return await this.withWindowId(targetId).getWindowInfo(options, requestOptions);
14
+ };
15
+ }
16
+ };
17
+ function playwrightPlugin() {
18
+ return {
19
+ pluginsToAdd: [plugin]
20
+ };
21
+ }
22
+ export {
23
+ playwrightPlugin
24
+ };
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { AirtopPluginAugmentationType } from \"@airtop/sdk\";\nimport type { AirtopSessionClient, AirtopSessionClientPlugin } from \"@airtop/sdk\";\nimport type { AirtopRequestOptions } from \"@airtop/sdk\";\nimport type { AirtopWindow } from \"@airtop/sdk\";\nimport type { WindowGetConfig } from \"@airtop/sdk\";\nimport type { AirtopPluginRegistration } from \"@airtop/sdk\";\nimport type { AirtopWindowGetInfoResponse } from \"@airtop/sdk\";\nimport type { Page } from \"playwright\";\n\n// This is exported so the docs can expose it as we can't generate docs against the\n// module declaration\n/**\n * The methods provided by the Playwright plugin.\n */\nexport interface PlaywrightPluginMethods {\n /**\n * Get the window information for a Playwright Page instance.\n * @param page The Playwright Page instance to get window information for.\n * @param options Configuration options for the window info request.\n * @param requestOptions Additional options to customize the request behavior.\n */\n getWindowInfoForPlaywrightPage(\n page: Page,\n options?: WindowGetConfig,\n requestOptions?: AirtopRequestOptions,\n ): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;\n}\n\ndeclare module \"@airtop/sdk\" {\n interface AirtopSessionClient {\n /**\n * Get the window information for a Playwright Page instance.\n * @param page The Playwright Page instance to get window information for.\n * @param options Configuration options for the window info request.\n * @param requestOptions Additional options to customize the request behavior.\n */\n getWindowInfoForPlaywrightPage(\n page: Page,\n options?: WindowGetConfig,\n requestOptions?: AirtopRequestOptions,\n ): Promise<AirtopWindow<AirtopWindowGetInfoResponse>>;\n }\n}\n\nconst plugin: AirtopSessionClientPlugin = {\n augmentationType: AirtopPluginAugmentationType.AirtopSessionClient,\n augment: (prototype: typeof AirtopSessionClient.prototype) => {\n prototype.getWindowInfoForPlaywrightPage = async function (\n page: Page,\n options: WindowGetConfig,\n requestOptions: AirtopRequestOptions,\n ) {\n const cdpSession = await page.context().newCDPSession(page);\n const { targetInfo } = await cdpSession.send(\"Target.getTargetInfo\");\n const targetId = targetInfo.targetId;\n if (!targetId) {\n throw new Error(\"TargetId not found\");\n }\n\n return await this.withWindowId(targetId).getWindowInfo(options, requestOptions);\n };\n },\n};\n\n/**\n * Use with registerAirtopPlugin() from the Airtop SDK to add the Playwright plugin.\n */\nexport function playwrightPlugin(): AirtopPluginRegistration {\n return {\n pluginsToAdd: [plugin],\n };\n}\n"],"mappings":";AAAA,SAAS,oCAAoC;AA4C7C,IAAM,SAAoC;AAAA,EACxC,kBAAkB,6BAA6B;AAAA,EAC/C,SAAS,CAAC,cAAoD;AAC5D,cAAU,iCAAiC,eACzC,MACA,SACA,gBACA;AACA,YAAM,aAAa,MAAM,KAAK,QAAQ,EAAE,cAAc,IAAI;AAC1D,YAAM,EAAE,WAAW,IAAI,MAAM,WAAW,KAAK,sBAAsB;AACnE,YAAM,WAAW,WAAW;AAC5B,UAAI,CAAC,UAAU;AACb,cAAM,IAAI,MAAM,oBAAoB;AAAA,MACtC;AAEA,aAAO,MAAM,KAAK,aAAa,QAAQ,EAAE,cAAc,SAAS,cAAc;AAAA,IAChF;AAAA,EACF;AACF;AAKO,SAAS,mBAA6C;AAC3D,SAAO;AAAA,IACL,cAAc,CAAC,MAAM;AAAA,EACvB;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@airtop/plugin-playwright",
3
+ "description": "Adds Playwright support to the Airtop SDK",
4
+ "version": "1.0.0-alpha2.0",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "exports": {
9
+ "import": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "require": {
14
+ "types": "./dist/index.d.cts",
15
+ "require": "./dist/index.cjs"
16
+ }
17
+ },
18
+ "types": "./dist/index.d.ts",
19
+ "license": "MIT",
20
+ "repository": "airtop-ai/airtop-sdk.git",
21
+ "author": "Theo Gravity <theo@airtop.ai>",
22
+ "keywords": [
23
+ "airtop",
24
+ "playwright",
25
+ "plugin"
26
+ ],
27
+ "scripts": {
28
+ "build": "tsup src/index.ts",
29
+ "test": "vitest --run",
30
+ "build:dev": "node_modules/.bin/hash-runner",
31
+ "clean": "rm -rf .turbo node_modules dist",
32
+ "lint": "biome check --write --unsafe src && biome format src --write && biome lint src --fix",
33
+ "verify-types": "tsc --noEmit"
34
+ },
35
+ "devDependencies": {
36
+ "@biomejs/biome": "1.9.4",
37
+ "@internal/tsconfig": "workspace:*",
38
+ "hash-runner": "2.0.1",
39
+ "tsup": "8.4.0",
40
+ "typescript": "5.8.2",
41
+ "vitest": "3.1.1"
42
+ },
43
+ "peerDependencies": {
44
+ "@airtop/sdk": "workspace:*",
45
+ "playwright": ">=1.51.1"
46
+ },
47
+ "bugs": "https://github.com/airtop-ai/airtop-sdk/issues",
48
+ "engines": {
49
+ "node": ">=18"
50
+ },
51
+ "files": [
52
+ "dist"
53
+ ],
54
+ "homepage": "https://airtop.ai",
55
+ "packageManager": "pnpm@10.5.0"
56
+ }